This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49224] New: Scoped enumeration instantiated even if not required
- From: "schaub.johannes at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 29 May 2011 14:19:21 +0000
- Subject: [Bug c++/49224] New: Scoped enumeration instantiated even if not required
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49224
Summary: Scoped enumeration instantiated even if not required
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: schaub.johannes@googlemail.com
GCC should not instantiate the definition of the scoped enumeration:
template<typename T>
struct A {
enum class B {
X = T::value
};
};
int main() {
A<int> a;
}
GCC error:
main1.cpp: In instantiation of âA<int>â:
main1.cpp:9:10: instantiated from here
main1.cpp:3:14: error: âvalueâ is not a member of âintâ
This code looks well-formed. Only if we look into the enumeration, as
"A<int>::B::X", the definition of the enumeration is required to exist and thus
implicitly instantiated. This is specified at 14.7.1p1 and p2.