Skip to content

incorrect error on correct code and crash on bad code in forward declaration of enum in template #23317

@llvmbot

Description

@llvmbot
Bugzilla Link 22943
Version 3.5
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor

Extended Description

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

Should compile clean but with

clang++ -std=c++11
a.cpp:9:15: error: no member named 'e1' in 'A'; did you mean simply 'e1'?
A::E e = A::e1;
^~~~~~~~~~
e1
a.cpp:5:38: note: 'e1' declared here
template enum A::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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++11clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions