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] PR 35331


Paolo Carlini wrote:
Hi Mark, all,
This is the sort of situation where I think we should be much more brutal.
+ template<typename...> struct A;
+ + template<typename...T> struct A<T*> // { dg-error "not expanded|T" }
+ {                                   // { dg-error "not expanded|T" }
+   friend void foo();
+ };
Rather than trying to make add_friend -- and every other function that might be called as we try to build up members of a erroneous class -- we should short-circuit the whole process. I would suggest we just skip everything inside the erroneous class -- look for the matching closing brace and be done with it. That will no doubt eliminate a bunch of crashses, making the compiler more robust. The downside, of course, is that the user may not get errors about things within the erroneous class until they fix the class -- but with a class that makes no sense, it's not clear that there's a whole lot in there we can be intelligent about.
Below you will find my second try, which tries to implement your suggestions. Tested x86_64-linux.

It looks better -- but can we go even further? Can we arrange to have begin_class_definition return error_mark_node in this case? I'd like to avoid having these half-formed bits of tree structure hanging about; they're just so darned crash-prone.


Thanks,

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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