c++/1833: [2003-01-01] inlining sometimes causes incorrect behavior
Giovanni Bajo
giovannibajo@libero.it
Thu May 8 23:22:00 GMT 2003
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=1833
Given Alexander's analysys, which I confirm, this PR boils down to the
following code:
--------------------------------
typedef char *pchar;
void func(pchar &s)
{}
int main ()
{
char *s = "123";
func((pchar)s);
}
--------------------------------
which is illegal, because the cast creates a temporary rvalue which cannot
be bound to a non-const reference. But GCC compiles it happily even
with -ansi -pedantic. So it's an accept-illegal.
Giovanni Bajo
More information about the Gcc-bugs
mailing list