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: [patch] Fix PR c++/22508 ICE after invalid operator new


On  8 Aug, Volker Reichelt wrote:
> Mark Mitchell wrote:
>> Volker Reichelt wrote:
>> > Consider the testcase
>> > 
>> >   struct A
>> >   {
>> >     void* operator new(__SIZE_TYPE__) throw(X);
>> >   };
>> > 
>> >   A* p = new A;
>> 
>> I rather think we should fix this by just ignoring the exception 
>> specification on the operator when its invalid.

Btw, one can generate an empty list of candidates also with the
following testcase:

  template<typename T> struct A
  {
      void* operator new(__SIZE_TYPE__,T);
  };

  void* p = new A<void>;

Therefore I'd really like to go with my first approach.

[snip]
 
>> The problem with keeping around invalid trees is that it's so easy to 
>> fall over them.  I think that we should try to work in the direction 
>> that whatever trees we keep are actually reasonable, rather than full of 
>> error_mark_nodes.
> 
> In theory I agree, in practice there are so many ways to write invalid
> C++ programs that this is a difficult task which

IMHO the above testcase is a nice example for this. ;-)

> a) is often not worth the hassle (and the bloat)
> b) can make error messages even worse - if the compiler is trying to be
>    smart and starts guessing what the user intended although something
>    completely different was intended. This usually srews up follow-up
>    messages completely.

Regards,
Volker



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