[LLVMbugs] [Bug 22943] New: incorrect error on correct code and crash on bad code in forward declaration of enum in template

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 17 12:14:55 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=22943

            Bug ID: 22943
           Summary: incorrect error on correct code and crash on bad code
                    in forward declaration of enum in template
           Product: clang
           Version: 3.5
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: camorton2 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

template<class T> struct A {
    enum E : T;
};
A<int> a;
template<class T> enum A<T>::E : T { e1, e2 };
#if _WRONG
A<int>::E er = e1;
#else
A<int>::E e = A<int>::e1;
#endif

Should compile clean but with 

clang++ -std=c++11
a.cpp:9:15: error: no member named 'e1' in 'A<int>'; did you mean simply 'e1'?
A<int>::E e = A<int>::e1;
              ^~~~~~~~~~
              e1
a.cpp:5:38: note: 'e1' declared here
template<class T> enum A<T>::E : T { e1, e2 };


clang++ -std=c++11 -D_WRONG
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5.0 (tags/RELEASE_350/final)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: 
********************


Testcase (not _WRONG) section is taken directly from the C++2011 standard
14.5.1.4 Enumeration members of class templates

the _WRONG section was an attempt to fix according to the clang diagnostic
message.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150317/b55feb3b/attachment.html>


More information about the llvm-bugs mailing list