file: test.cpp
template <class T>
T make();
struct p {};
struct c : decltype(make<p>()) {};
compilation command:
g++ -c -std=c++0x test.cpp
output:
test.cpp:5: error: expected class-name before 'decltype'
test.cpp:5: error: expected '{' before 'decltype'
test.cpp:5: error: expected unqualified-id before '{' token
Expected result:
c should inherit p and everything should compile fine.
Note that this can be worked around with the following modification:
template <class T>
T make();
template <class T> struct wrap {
typedef T type;
};
struct p {};
struct c : wrap< decltype(make<p>()) >::type {};
However this modification is cumbersome and seems pointless.
--
Summary: decltype not supported for parent class specifier
Product: gcc
Version: 4.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gccbugs at blaggart dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42603