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]

[Bug c++/52018] GCC refuses to accept a disambiguation statement


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));


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