[Bug c++/49129] New: confusing diagnostic for missing semi-colon after member template

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 23 18:42:00 GMT 2011


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

           Summary: confusing diagnostic for missing semi-colon after
                    member template
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org
                CC: froydnj@gcc.gnu.org


typedef int I;

struct X
{
  template<class> struct Y { }  // oops, missing ';'

  static I f();
};

expinit.cc:7:12: error: expected initializer before ‘f’


If f returns 'int' instead of a typedef then the error is good:
expinit.cc:5:30: error: expected ‘;’ after struct definition

If X::Y is not a template then the error is good:
expinit.cc:7:10: error: expected ‘;’ at end of member declaration
expinit.cc:7:14: error: ISO C++ forbids declaration of ‘f’ with no type
[-fpermissive]



More information about the Gcc-bugs mailing list