https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116099
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For comparison, Clang also doesn't give consistent errors:
x.cc:3:3: error: use of undeclared identifier 'Oops'
3 | S<Oops> o;
| ^
x.cc:4:9: error: unknown type name 'Oops'
4 | S<const Oops> oo;
| ^
2 errors generated.
And neither does EDG:
"x.cc", line 3: error: identifier "Oops" is undefined
S<Oops> o;
^
"x.cc", line 4: error: explicit type is missing ("int" assumed)
S<const Oops> oo;
^
"x.cc", line 4: error: expected a ">"
S<const Oops> oo;
^
3 errors detected in the compilation of "x.cc".
And MSVC says:
Compiler stdout
<source>(3): error C2065: 'Oops': undeclared identifier
<source>(3): error C2923: 'S': 'Oops' is not a valid template type argument for
parameter 'T'
<source>(3): note: see declaration of 'Oops'
<source>(3): error C2133: 'o': unknown size
<source>(3): error C2512: 'S': no appropriate default constructor available
<source>(1): note: see declaration of 'S'
<source>(4): error C4430: missing type specifier - int assumed. Note: C++ does
not support default-int
<source>(4): error C2146: syntax error: missing '>' before identifier 'Oops'
Both EDG and MSVC seem to have an implicit int thing going on, maybe GCC does
too?