Hi everybody,

TL;DR:
What is the reason that `error: '<some class>' has incomplete type` does 
not give a note about where the forward declaration happened for 
standard library classes?
Full:

Recently, I forgot to include <array> but had <tuple> included. Due to this recent commit for gcc12
https://github.com/gcc-mirror/gcc/commit/261d5a4a459bd49942e53bc83334ccc7154a09d5

the `error: 'std::array<int,N>' has incomplete type` felt like a weird regression because all other major gcc versions as well as clang compiled just fine. After many hours of debugging, I finally realised that it was just a missing header and now the error message actually makes sense.
But when I experimented with this, I found that gcc does give you 
another `<filename>:<line number>:<column number>: note: declaration of 
'class SomeClass<int>'` with line number and everything. Now, I wonder 
why gcc doesn't do that for standard headers (at least not in my 
particular case). Is there a compelling argument for that? It feels like 
it must be intentional. If not, I would suggest adding that because I'm 
pretty sure it would have spared me a couple of hours just by realising 
quickly that it takes `std::array` from the wrong header.
Thank you in advance and keep up the great work!

Julian


Reply via email to