new C++ parser bug
Matt Austern
austern@apple.com
Thu Feb 13 20:43:00 GMT 2003
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
More information about the Gcc
mailing list