http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52018
Bug #: 52018
Summary: GCC refuses to accept a disambiguation statement
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The following code:
class string {};
struct test {
enum {
string
};
void g(class string&& s) const {}
template <typename... TA> void mth(TA&&... args) const {
g(class string{std::forward<TA>(args)...});
}
};
compiled using GCC 4.6.1 and 4.6.2 fails:
$ g++ -std=gnu++0x -c test/test.cpp
test/test.cpp: In member function ‘void test::mth(TA&& ...) const’:
test/test.cpp:15:11: error: expected primary-expression before ‘class’
The Holy Book says:
3.4.4: "An elaborated-type-specifier (7.1.6.3) may be used to refer to a
previously declared class-name or enum-name
even though the name has been hidden by a non-type declaration (3.3.10)."
and the problematic statement:
g(class string{std::forward<TA>(args)...});
looks like a reference.