[cfe-commits] r81063 - in /cfe/trunk: lib/Sema/SemaTemplateInstantiate.cpp test/SemaTemplate/default-expr-arguments.cpp
Anders Carlsson
andersca at mac.com
Fri Sep 4 22:38:54 PDT 2009
Author: andersca
Date: Sat Sep 5 00:38:54 2009
New Revision: 81063
URL: http://llvm.org/viewvc/llvm-project?rev=81063&view=rev
Log:
Report errors for member functions correctly.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=81063&r1=81062&r2=81063&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Sat Sep 5 00:38:54 2009
@@ -293,7 +293,6 @@
case ActiveTemplateInstantiation::DefaultFunctionArgumentInstantiation: {
ParmVarDecl *Param = cast<ParmVarDecl>((Decl *)Active->Entity);
FunctionDecl *FD = cast<FunctionDecl>(Param->getDeclContext());
- TemplateDecl *Template = FD->getPrimaryTemplate();
std::string TemplateArgsStr
= TemplateSpecializationType::PrintTemplateArgumentList(
@@ -302,7 +301,7 @@
Context.PrintingPolicy);
Diags.Report(FullSourceLoc(Active->PointOfInstantiation, SourceMgr),
diag::note_default_function_arg_instantiation_here)
- << (Template->getNameAsString() + TemplateArgsStr)
+ << (FD->getNameAsString() + TemplateArgsStr)
<< Active->InstantiationRange;
break;
}
Modified: cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp?rev=81063&r1=81062&r2=81063&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp (original)
+++ cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp Sat Sep 5 00:38:54 2009
@@ -21,6 +21,7 @@
template<typename T> struct F {
F(T t = 10);
+ void f(T t = 10); // expected-error{{cannot initialize 't' with an rvalue of type 'int'}}
};
struct FD : F<int> { };
@@ -30,6 +31,11 @@
FD fd;
}
+void g3(F<int> f, F<struct S> s) {
+ f.f();
+ s.f(); // expected-note{{in instantiation of default function argument expression for 'f<struct S>' required here}}
+}
+
template<typename T> struct G {
G(T) {}
};
@@ -37,3 +43,4 @@
void s(G<int> flags = 10) { }
+
More information about the cfe-commits
mailing list