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 second part of PR c++/27601: ICE using offsetof with member functions


Volker Reichelt wrote:
> While applying
>   http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00161.html
> I noticed that the following invalid code snippet also triggers an ICE:
> 
>   struct bar {
>     void foo();
>   };
> 
>   int a = __builtin_offsetof(bar, foo);
> 
> bug.cc:5: internal compiler error: tree check: expected field_decl, have baselink in fold_offsetof_1, at c-common.c:5992
> Please submit a full bug report, [etc.]

Can't we catch this in the C++ parser?  __builtin_offsetof is handled by
its own parsing routine, so before we call fold_offsetof, we already
know what EXPR is.  Wouldn't calling invalid_nonstatic_memfn_p fix this?


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