mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-19 19:45:40 -04:00

Summary: 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(); } Reviewers: eli.friedman, rsmith, doug.gregor, faisalv Reviewed By: doug.gregor CC: cfe-commits, ygao Differential Revision: http://llvm-reviews.chandlerc.com/D1866 llvm-svn: 193144
88 lines
1.3 KiB
C++
88 lines
1.3 KiB
C++
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
|
|
|
|
// CHECK: @_ZZ4FUNCvEN4SSSSC1ERKf
|
|
// CHECK: @_ZZ4FUNCvEN4SSSSC2E_0RKf
|
|
// CHECK: @_ZZ4GORFfEN4SSSSC1ERKf
|
|
// CHECK: @_ZZ4GORFfEN4SSSSC2E_0RKf
|
|
|
|
void FUNC ()
|
|
{
|
|
{
|
|
float IVAR1 ;
|
|
|
|
struct SSSS
|
|
{
|
|
float bv;
|
|
SSSS( const float& from): bv(from) { }
|
|
};
|
|
|
|
SSSS VAR1(IVAR1);
|
|
}
|
|
|
|
{
|
|
float IVAR2 ;
|
|
|
|
struct SSSS
|
|
{
|
|
SSSS( const float& from) {}
|
|
};
|
|
|
|
SSSS VAR2(IVAR2);
|
|
}
|
|
}
|
|
|
|
void GORF (float IVAR1)
|
|
{
|
|
{
|
|
struct SSSS
|
|
{
|
|
float bv;
|
|
SSSS( const float& from): bv(from) { }
|
|
};
|
|
|
|
SSSS VAR1(IVAR1);
|
|
}
|
|
|
|
{
|
|
float IVAR2 ;
|
|
|
|
struct SSSS
|
|
{
|
|
SSSS( const float& from) {}
|
|
};
|
|
|
|
SSSS VAR2(IVAR2);
|
|
}
|
|
}
|
|
|
|
// CHECK: @_ZZ12OmittingCodefEN4SSSSC1E_0RKf
|
|
inline void OmittingCode(float x) {
|
|
if (0) {
|
|
struct SSSS {
|
|
float bv;
|
|
SSSS(const float& from): bv(from) { }
|
|
};
|
|
|
|
SSSS VAR1(x);
|
|
}
|
|
|
|
struct SSSS {
|
|
float bv;
|
|
SSSS(const float& from): bv(from) { }
|
|
};
|
|
|
|
SSSS VAR2(x);
|
|
}
|
|
void CallOmittingCode() { OmittingCode(1); }
|
|
|
|
// CHECK: @_ZZ15LocalAnonStructvENUt0_1gEv
|
|
inline void LocalAnonStruct() {
|
|
if (0) {
|
|
struct { void f() {} } x;
|
|
x.f();
|
|
}
|
|
struct { void g() {} } y;
|
|
y.g();
|
|
}
|
|
void CallLocalAnonStruct() { LocalAnonStruct(); }
|