diff options
-rw-r--r-- | lib/Sema/TreeTransform.h | 4 | ||||
-rw-r--r-- | test/SemaTemplate/instantiate-expr-1.cpp | 16 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 2c6c615a11..0216621d1e 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -4906,8 +4906,10 @@ TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) { if (!getDerived().AlwaysRebuild() && T == E->getType() && Constructor == E->getConstructor() && - !ArgumentChanged) + !ArgumentChanged) { + SemaRef.MarkDeclarationReferenced(E->getLocStart(), Constructor); return SemaRef.Owned(E->Retain()); + } return getDerived().RebuildCXXConstructExpr(T, /*FIXME:*/E->getLocStart(), Constructor, E->isElidable(), diff --git a/test/SemaTemplate/instantiate-expr-1.cpp b/test/SemaTemplate/instantiate-expr-1.cpp index d1b05f66a5..4594621103 100644 --- a/test/SemaTemplate/instantiate-expr-1.cpp +++ b/test/SemaTemplate/instantiate-expr-1.cpp @@ -137,3 +137,19 @@ void test_asm() { int b; test_asm(b); // expected-note {{in instantiation of function template specialization 'test_asm<int>' requested here}} } + +namespace PR6424 { + template<int I> struct X { + X() { + int *ip = I; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} + } + }; + + template<int> struct Y { + typedef X<7> X7; + + void f() { X7(); } // expected-note{{instantiation}} + }; + + template void Y<3>::f(); +} |