https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88210

            Bug ID: 88210
           Summary: Add fix-it hint for explicit template instantiations
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          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: ---

namespace x {
  template<typename T> struct blah { };
}

extern template class blah<int>;

template class blah<int>;


This produces:

expl.cc:5:23: error: 'blah' is not a class template
    5 | extern template class blah<int>;
      |                       ^~~~
expl.cc:5:23: error: explicit instantiation of non-template type 'blah'
expl.cc:7:16: error: 'blah' is not a class template
    7 | template class blah<int>;
      |                ^~~~
expl.cc:7:16: error: explicit instantiation of non-template type 'blah'


It would be helpful to suggest x::blah instead of just saying "is not a class
template".

It took me a while to realise the problem here, because I've got used to GCC
now saying "did you mean x::blah?" when that's what the problem is.

Reply via email to