This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52018] GCC refuses to accept a disambiguation statement
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 Jan 2012 08:56:28 +0000
- Subject: [Bug c++/52018] GCC refuses to accept a disambiguation statement
- Auto-submitted: auto-generated
- References: <bug-52018-4@http.gcc.gnu.org/bugzilla/>
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));