With gcc11 (11.3.1) I'm seeing a strange behavior where it seems that -idirafter path takes precedence over -iquote path if path is the same for both options.
Consider:
// test/foo.hpp
#pragma once
auto foo{ char{ 256 } };
// test/foo.cpp
#include "test/foo.hpp"
As one would expect, if we try to compile form the parent directory of test/, we get
$ g++ -iquote. -c test/foo.cpp -o foo.o
In file included from test/foo.cpp:1:
./test/foo.hpp:5:21: error: narrowing conversion of '256' from 'int' to 'char' [-Wnarrowing]
5 | auto foo{ char{ 256 } };
|
However, adding -idirafter. makes everything compile:
$ g++ -iquote. -idirafter. -c test/foo.cpp -o foo.o
clang, gcc14 and gcc15 do not exhibit this behavior. However, I could not find any references to a bug in gcc11. I was wondering if anyone seen similar issue or there is a bug report I might've missed and if there is a possible patch? Obviously, if someone could confirm or dispel the issue, it'd be great.
Thanks!