On 8/6/19 8:28 AM, Paolo Carlini wrote:
apparently this is now easy to do, likely because a while ago I made sure that we consistently have meaningful locations for TYPE_DECLs too.

(I went through grokdeclarator and confirmed that when the third argument is FUNCDEF or MEMFUNCDEF it cannot return NULL_TREE)

-typedef void foo () {} // { dg-error "invalid function declaration" }
+typedef void foo () {} // { dg-error "14:invalid function declaration" }
 struct S
 {
-  typedef int bar (void) { return 0; } // { dg-error "invalid member function 
declaration" }
+  typedef int bar (void) { return 0; }  // { dg-error "15:invalid member function 
declaration" }

Maybe we could give a more specific diagnostic in grokdeclarator; perhaps under

  if (typedef_p && decl_context != TYPENAME)

complain and return error_mark_node in FUNCDEF or MEMFUNCDEF context.

Jason

Reply via email to