This is the mail archive of the gcc-bugs@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]

[Bug c++/1920] no warning or error with cast-as-lvalue extension


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1920


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-06 05:41 -------
It was promised that this extension will be removed but who knows. 3.4 will reject the code that 
uses this.
With this testcase:
typedef char *pchar;
 void func(pchar &s)
 {}
 int main ()
 {
     char *s = "123";
     func((pchar)s);
 }
the mainline (20030805) now ICEs:

pr1833.2.cc: In function `int main()':
pr1833.2.cc:9: internal compiler error: in convert_like_real, at cp/call.c:4131
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Here is one which does not ICE but is accepted:
 extern int do_stuff(void *bar);
 int f(char *str)
 {
     void *foo;
     (char *) foo = str+1;
     return do_stuff(foo);
 }

Here is another case where gcc ICEs:
enum _t
{
    off = 0,
    on = 100
};
void fn(int& x)
{
    x = on;
}
int main()
{
    _t t = off;
    fn((int)t);
}


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