[LLVMbugs] [Bug 10044] New: Scoped enumeration instantiated even if not required

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat May 28 06:37:19 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10044

           Summary: Scoped enumeration instantiated even if not required
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: schaub.johannes at googlemail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Clang 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;
}

Clang error:

main1.cpp:4:9: error: type 'int' cannot be used prior to '::' because it has no
members
    X = T::value

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.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list