[Bug c++/14283] Diagnostic for invalid template-id could be improved

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Sep 27 16:13:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14283

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
                 CC|                            |manu at gcc dot gnu.org
      Known to fail|                            |

--- Comment #13 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-09-27 15:44:31 UTC ---
In GCC 4.5.3:

test.cc:5:13: error: ‘INVALID’ in class ‘A’ does not name a type

It should say: 5:25: error: ‘INVALID’ in class ‘A’ does not name a template

Notice that the location of the error is also wrong.

Clang gives a better diagnostic, but an extra superfluous one:

/tmp/webcompile/_14799_0.cc:5:25: error: 'INVALID' following the 'template'
keyword does not refer to a template
    typedef A::template INVALID<void> X;
               ~~~~~~~~ ^~~~~~~
/tmp/webcompile/_14799_0.cc:5:32: error: expected member name or ';' after
declaration specifiers
    typedef A::template INVALID<void> X;
    ~~~~~~~                    ^
2 errors generated.



More information about the Gcc-bugs mailing list