This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52018] New: GCC refuses to accept a disambiguation statement
- From: "piotr.wyderski at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 27 Jan 2012 12:18:26 +0000
- Subject: [Bug c++/52018] New: GCC refuses to accept a disambiguation statement
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: piotr.wyderski@gmail.com
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.