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]

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


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