This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] Improve start_function and grokmethod locations


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]