[Bug c++/52018] GCC refuses to accept a disambiguation statement
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 30 09:24:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52018
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler at
| |googlemail dot com
--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-01-30 08:56:28 UTC ---
The compiler behaves conforming: An elaborated type specifier is not allowed in
this context (see [expr.type.conv] p1 which says "A simple-type-specifier
(7.1.6.2) or typename-specifier (14.6) [..]", they are only allowed in
restricted context like a new expression for example. Note that similar
expressions apply more general type-specifiers like "unsigned int" which cannot
be used in such an expression. In other words: This does not look like a bug to
me. A reduced example would be the following snippet:
struct string { string(int); };
enum { string };
void h(struct string);
int main() {
h(class string(42));
}
A simple workaround is to introduce a local typename-specifier:
typedef class string c_t;
h(c_t(42));
More information about the Gcc-bugs
mailing list