[PATCH] Sema: Do not allow template declarations inside local classes
David Majnemer
david.majnemer at gmail.com
Wed Oct 9 00:48:07 PDT 2013
Hi eli.friedman, rsmith, doug.gregor, faisalv,
Enforce the rule in C++11 [temp.mem]p2 that local classes cannot have
member templates.
This fixes PR16947.
N.B. C++14 has slightly different wording to afford generic lambdas
declared inside of functions.
Fun fact: Some formulations of local classes with member templates
would cause clang to crash during Itanium mangling, such as the
following:
void outer_mem() {
struct Inner {
template <typename = void>
struct InnerTemplateClass {
static void itc_mem() {}
};
};
Inner::InnerTemplateClass<>::itc_mem();
}
http://llvm-reviews.chandlerc.com/D1866
Files:
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaTemplate.cpp
test/CXX/temp/temp.decls/temp.mem/p2.cpp
test/CodeGenCXX/mangle-local-class-names.cpp
test/PCH/cxx-local-templates.cpp
test/PCH/cxx1y-local-templates.cpp
test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
test/SemaTemplate/local-member-templates.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1866.1.patch
Type: text/x-patch
Size: 9183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131009/d7de590d/attachment.bin>
More information about the cfe-commits
mailing list