This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/1833: [2003-01-01] inlining sometimes causes incorrect behavior
- From: "Giovanni Bajo" <giovannibajo at libero dot it>
- To: <gcc-gnats at gcc dot gnu dot org>,<gcc-bugs at gcc dot gnu dot org>,<nobody at gcc dot gnu dot org>,<gcc-prs at gcc dot gnu dot org>,<peteb at sitera dot com>
- Date: Fri, 9 May 2003 01:17:04 +0200
- Subject: Re: c++/1833: [2003-01-01] inlining sometimes causes incorrect behavior
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