This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
new C++ parser bug
- From: Matt Austern <austern at apple dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 13 Feb 2003 12:35:57 -0800
- Subject: new C++ parser bug
Anyone tried building QT with top of mainline? I just tried this
morning
(using top of tree as of yesterday morning), and it failed because of a
compiler bug. Here's a small test case:
struct Str
{
Str( const char *str );
Str frob() const;
operator const char *() const;
};
void foo(int x, const Str& str)
{
x ? str : str.frob();
}
The error message I get is:
foo.ii: In function `void foo(int, const Str&)':
foo.ii:10: error: non-lvalue in unary `&'
This code compiles cleanly with 3.3, and the error message is of
course nonsense. And I could be missing something, but I believe
this code ought to compile. Yes, it's bad style to have a class with
a const char* constructor and also an operator const char*, but this
class isn't being used in a way that should choke on any ambiguities.
So, before I spend time trying to understand how to fix this...
Is this a known bug?
--Matt