https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101712
Bug ID: 101712
Summary: Bad error message with reference to nested type.
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tobi at gcc dot gnu.org
Target Milestone: ---
==========================================================
template<class A, class B, class C>
class pq;
template<typename F>
class A {
struct QD {
int a;
struct Comparator {
};
};
pq<QD, int, QD::Comparator> queueBad;
pq<QD, int, typename QD::Comparator> queueCorrect;
};
==========================================================
gives (https://godbolt.org/z/n7v97z17s):
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<source>:11:31: error: type/value mismatch at argument 3 in template parameter
list for 'template<class A, class B, class C> class pq'
11 | pq<QD, int, QD::Comparator> queueBad;
| ^
<source>:11:31: note: expected a type, got 'A<F>::QD::Comparator'
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
To which my response is "A<F>::QD::Comparator is a type". Compare this to
clang's clear and actionable:
----------------------------------------------------------
<source>:11:17: error: template argument for template type parameter must be a
type; did you forget 'typename'?
pq<QD, int, QD::Comparator> queueBad;
^
typename
<source>:1:34: note: template parameter is declared here
template<class A, class B, class C>
^
1 error generated.
----------------------------------------------------------
Besides not being actionable, "type/value mismatch" appears to be a
compiler-internal category of problem and thus isn't very user-friendly.