public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/7775: std::string foo = foo + "b" is erroneously compiled
@ 2002-08-30 13:06 Gabriel Dos Reis
0 siblings, 0 replies; 6+ messages in thread
From: Gabriel Dos Reis @ 2002-08-30 13:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/7775; it has been noted by GNATS.
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: Peter Schlaile <udbz@rz.uni-karlsruhe.de>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/7775: std::string foo = foo + "b" is erroneously compiled
Date: 30 Aug 2002 21:31:45 +0200
Peter Schlaile <udbz@rz.uni-karlsruhe.de> writes:
| Hi!
|
| On 30 Aug 2002, Gabriel Dos Reis wrote:
|
| > udbz@rz.uni-karlsruhe.de writes:
| >
| > No, this is not a bug. Just before "=", the name foo is available for
| > use. The bevaviour is undefined, but that doesn't mean the compiler
| > is bogus. It is a bug in your program.
|
| I don't mind
Sure, you should, because you filled this PR as a "accept-illegal".
And the code wasn't invalid and the compiler was right in accepting
it.
-- Gaby
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c++/7775: std::string foo = foo + "b" is erroneously compiled
@ 2002-08-30 11:36 Peter Schlaile
0 siblings, 0 replies; 6+ messages in thread
From: Peter Schlaile @ 2002-08-30 11:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/7775; it has been noted by GNATS.
From: Peter Schlaile <udbz@rz.uni-karlsruhe.de>
To: Gabriel Dos Reis <gdr@integrable-solutions.net>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/7775: std::string foo = foo + "b" is erroneously compiled
Date: Fri, 30 Aug 2002 20:00:44 +0200 (CEST)
Hi!
On 30 Aug 2002, Gabriel Dos Reis wrote:
> udbz@rz.uni-karlsruhe.de writes:
>
> No, this is not a bug. Just before "=", the name foo is available for
> use. The bevaviour is undefined, but that doesn't mean the compiler
> is bogus. It is a bug in your program.
I don't mind if eventually this conforms to the C++ standard (which is
strange enough, since
string foo(foo + "a");
is an error), but most definitely you should throw a warning!
Regards,
Peter
---
Peter Schlaile *** eMail udbz@rz.uni-karlsruhe.de
So Linus, what are we doing tonight?
The same thing we do every night Tux. Try to take over the world!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c++/7775: std::string foo = foo + "b" is erroneously compiled
@ 2002-08-30 10:06 Gabriel Dos Reis
0 siblings, 0 replies; 6+ messages in thread
From: Gabriel Dos Reis @ 2002-08-30 10:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/7775; it has been noted by GNATS.
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: nathan@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org,
udbz@rz.uni-karlsruhe.de, gcc-gnats@gcc.gnu.org
Subject: Re: c++/7775: std::string foo = foo + "b" is erroneously compiled
Date: 30 Aug 2002 18:40:07 +0200
nathan@gcc.gnu.org writes:
| Synopsis: std::string foo = foo + "b" is erroneously compiled
|
| State-Changed-From-To: open->closed
| State-Changed-By: nathan
| State-Changed-When: Fri Aug 30 09:07:58 2002
| State-Changed-Why:
| The code is ill-formed. No diagnostic is required.
Well, the code invokes an undefined behaviour, but it is not
ill-formed.
-- Gaby
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c++/7775: std::string foo = foo + "b" is erroneously compiled
@ 2002-08-30 9:46 Gabriel Dos Reis
0 siblings, 0 replies; 6+ messages in thread
From: Gabriel Dos Reis @ 2002-08-30 9:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/7775; it has been noted by GNATS.
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: udbz@rz.uni-karlsruhe.de
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/7775: std::string foo = foo + "b" is erroneously compiled
Date: 30 Aug 2002 18:37:32 +0200
udbz@rz.uni-karlsruhe.de writes:
| >Number: 7775
| >Category: c++
| >Synopsis: std::string foo = foo + "b" is erroneously compiled
| >Confidential: no
| >Severity: serious
| >Priority: medium
| >Responsible: unassigned
| >State: open
| >Class: accepts-illegal
No, this is not a bug. Just before "=", the name foo is available for
use. The bevaviour is undefined, but that doesn't mean the compiler
is bogus. It is a bug in your program.
-- Gaby
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c++/7775: std::string foo = foo + "b" is erroneously compiled
@ 2002-08-30 9:26 nathan
0 siblings, 0 replies; 6+ messages in thread
From: nathan @ 2002-08-30 9:26 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, udbz
Synopsis: std::string foo = foo + "b" is erroneously compiled
State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Fri Aug 30 09:07:58 2002
State-Changed-Why:
The code is ill-formed. No diagnostic is required.
string foo = foo + "b";
is equivalent to
string foo (string (foo.operator+ ("b"));
which calls string::operator+ on foo, before it has been
constructed
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7775
^ permalink raw reply [flat|nested] 6+ messages in thread
* c++/7775: std::string foo = foo + "b" is erroneously compiled
@ 2002-08-30 9:06 udbz
0 siblings, 0 replies; 6+ messages in thread
From: udbz @ 2002-08-30 9:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 7775
>Category: c++
>Synopsis: std::string foo = foo + "b" is erroneously compiled
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Fri Aug 30 08:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: udbz@rz.uni-karlsruhe.de
>Release: gcc-3.0.3
>Organization:
>Environment:
>Description:
GCC is too permissive when it comes to initialization
with operator=(): It will even generate illegal code
on optimization-level -O3:
#include <iostream.h>
#include <string>
int main()
{
std::string foo = foo + "b";
std::cout << foo << endl;
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-08-30 19:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-30 13:06 c++/7775: std::string foo = foo + "b" is erroneously compiled Gabriel Dos Reis
-- strict thread matches above, loose matches on Subject: below --
2002-08-30 11:36 Peter Schlaile
2002-08-30 10:06 Gabriel Dos Reis
2002-08-30 9:46 Gabriel Dos Reis
2002-08-30 9:26 nathan
2002-08-30 9:06 udbz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).