summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiate-local-class.cpp
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2015-05-15 10:10:28 +0000
committerSerge Pavlov <sepavloff@gmail.com>2015-05-15 10:10:28 +0000
commite7ad831241e752f32f5f65e94ae3f1d0d8ad8894 (patch)
tree9f51f2de7544174f9d8b1d4fe5f43279ba670824 /clang/test/SemaTemplate/instantiate-local-class.cpp
parent6f48e0fd2b4bd186a4ddab4456290501258bb98f (diff)
downloadbcm5719-llvm-e7ad831241e752f32f5f65e94ae3f1d0d8ad8894.tar.gz
bcm5719-llvm-e7ad831241e752f32f5f65e94ae3f1d0d8ad8894.zip
Limit set of types instantiated in FindInstantiatedDecl.
Starting from r236426 FindInstantiatedDecl may instantiate types that are referenced before definition. This change limit the set of types that can be instantiated by this function. llvm-svn: 237434
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-local-class.cpp')
-rw-r--r--clang/test/SemaTemplate/instantiate-local-class.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-local-class.cpp b/clang/test/SemaTemplate/instantiate-local-class.cpp
index ff6cf7923f1..f58d7a49622 100644
--- a/clang/test/SemaTemplate/instantiate-local-class.cpp
+++ b/clang/test/SemaTemplate/instantiate-local-class.cpp
@@ -225,6 +225,12 @@ namespace PR18653 {
}
template void f1<int>();
+ template<typename T> void f1a() {
+ void g1(union x1);
+ union x1 {};
+ }
+ template void f1a<int>();
+
template<typename T> void f2() {
void g2(enum x2); // expected-error{{ISO C++ forbids forward references to 'enum' types}}
enum x2 { nothing };
@@ -243,11 +249,17 @@ namespace PR18653 {
}
template void f4<int>();
+ template<typename T> void f4a() {
+ void g4(union x4 {} x); // expected-error{{'x4' cannot be defined in a parameter type}}
+ }
+ template void f4a<int>();
+
template <class T> void f();
template <class T> struct S1 {
void m() {
f<class newclass>();
+ f<union newunion>();
}
};
template struct S1<int>;
@@ -274,6 +286,14 @@ namespace PR18653 {
};
template struct S4<int>;
+ template <class T> struct S4a {
+ union local {};
+ void m() {
+ f<local>();
+ }
+ };
+ template struct S4a<int>;
+
template <class T> struct S5 {
enum local { nothing };
void m() {
@@ -301,6 +321,15 @@ namespace PR18653 {
};
template struct S01<int>;
+ template <class T> struct S01a {
+ union local { };
+ void m() {
+ local x;
+ fff(&x);
+ }
+ };
+ template struct S01a<int>;
+
template <class T> struct S02 {
enum local { nothing };
void m() {
@@ -328,6 +357,14 @@ namespace PR18653 {
};
template struct S04<int>;
+ template <class T> struct S04a {
+ void m() {
+ union { } x;
+ fff(&x);
+ }
+ };
+ template struct S04a<int>;
+
template <class T> struct S05 {
void m() {
enum { nothing } x;
OpenPOWER on IntegriCloud