summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiate-expr-4.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-12-12 18:16:41 +0000
committerDouglas Gregor <dgregor@apple.com>2009-12-12 18:16:41 +0000
commit6131b4418387d55374bda7ddb211ff3e6656cb86 (patch)
tree0ab395df254a7bbf3b83b464592a532415bc1be2 /clang/test/SemaTemplate/instantiate-expr-4.cpp
parent5c9429fa474381e637a06f7b1334afc4323d9716 (diff)
downloadbcm5719-llvm-6131b4418387d55374bda7ddb211ff3e6656cb86.tar.gz
bcm5719-llvm-6131b4418387d55374bda7ddb211ff3e6656cb86.zip
Rework the way we handle template instantiation for
implicitly-generated AST nodes. We previously built instantiated nodes for each of these AST nodes, then passed them on to Sema, which was not prepared to see already-type-checked nodes (see PR5755). In some places, we had ugly workarounds to try to avoid re-type-checking (e.g., in VarDecl initializer instantiation). Now, we skip implicitly-generated nodes when performing instantiation, preferring instead to build just the AST nodes that directly reflect what was written in the source code. This has several advantages: - We don't need to instantiate anything that doesn't have a direct correlation to the source code, so we can have better location information. - Semantic analysis sees the same thing at template instantiation time that it would see for a non-template. - At least one ugly hack (VarDecl initializers) goes away. Fixes PR5755. llvm-svn: 91218
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-expr-4.cpp')
-rw-r--r--clang/test/SemaTemplate/instantiate-expr-4.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-expr-4.cpp b/clang/test/SemaTemplate/instantiate-expr-4.cpp
index 150faec3f2a..b99ec3304c4 100644
--- a/clang/test/SemaTemplate/instantiate-expr-4.cpp
+++ b/clang/test/SemaTemplate/instantiate-expr-4.cpp
@@ -96,6 +96,18 @@ template struct Delete0<int*>;
template struct Delete0<X*>;
template struct Delete0<int>; // expected-note{{instantiation}}
+namespace PR5755 {
+ template <class T>
+ void Foo() {
+ char* p = 0;
+ delete[] p;
+ }
+
+ void Test() {
+ Foo<int>();
+ }
+}
+
// ---------------------------------------------------------------------
// throw expressions
// ---------------------------------------------------------------------
OpenPOWER on IntegriCloud