https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87091
Bug ID: 87091
Summary: Malformed fix-it hint for missing header
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
CC: dmalcolm at gcc dot gnu.org
Target Milestone: ---
Created attachment 44590
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44590&action=edit
Preprocessed source
With today's trunk the following fails (due to a libstdc++ bug I'm fixing):
#define _GLIBCXX_DEBUG 1
#include <debug/vector>
int main() { }
g++ -std=gnu++17 x.cc
In file included from /home/jwakely/gcc/9/include/c++/9.0.0/debug/vector:34,
from x.cc:2:
/home/jwakely/gcc/9/include/c++/9.0.0/vector:87:27: error: ‘vector’ in
namespace ‘std’ does not name a template type
87 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
/home/jwakely/gcc/9/include/c++/9.0.0/vector:87:22: note: ‘std::vector’ is
defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
/home/jwakely/gcc/9/include/c++/9.0.0/vector:74:1:
|+#include <vector>
/home/jwakely/gcc/9/include/c++/9.0.0/vector:74:1:74 | #endif
/home/jwakely/gcc/9/include/c++/9.0.0/vector:87:22:
/home/jwakely/gcc/9/include/c++/9.0.0/vector:87:22:87 | using vector =
std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~
The fix-it is mangled. I don't know what the #endif is doing there, and the
caret location points to the characters "e/c" of the filename, because the
quoted source is prefixed by the filename but the caret line isn't. It seems
like the repeated filename is not being suppressed, but the caret expects it to
be.