diff options
author | Nico Weber <nicolasweber@gmx.de> | 2010-11-30 04:44:33 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2010-11-30 04:44:33 +0000 |
commit | 15d5c83ce698a6b6ae1166f9008c6ead34ae7a5d (patch) | |
tree | 80380cb28cdd200b7d482f49ec23480a99428530 | |
parent | 9b4b9d6d221ab804f5b65fec6c8661be4d5c2b84 (diff) |
Fix bug in r120299 spotted by dgregor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120389 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 6 | ||||
-rw-r--r-- | test/SemaCXX/friend.cpp | 18 |
2 files changed, 21 insertions, 3 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index e8025409bd..19b0749843 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -3843,10 +3843,10 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc, ParmVarDecl *Param) { if (Param->hasUnparsedDefaultArg()) { Diag(CallLoc, - diag::err_use_of_default_argument_to_function_declared_later) << + diag::err_use_of_default_argument_to_function_declared_later) << FD << cast<CXXRecordDecl>(FD->getDeclContext())->getDeclName(); Diag(UnparsedDefaultArgLocs[Param], - diag::note_default_argument_declared_here); + diag::note_default_argument_declared_here); return ExprError(); } @@ -3868,7 +3868,7 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc, // The names in the [default argument] expression are bound, and // the semantic constraints are checked, at the point where the // default argument expression appears. - ContextRAII SavedContext(*this, FD->getDeclContext()); + ContextRAII SavedContext(*this, FD); Result = SubstExpr(UninstExpr, ArgList); } if (Result.isInvalid()) diff --git a/test/SemaCXX/friend.cpp b/test/SemaCXX/friend.cpp index 515edfd949..1222dd0940 100644 --- a/test/SemaCXX/friend.cpp +++ b/test/SemaCXX/friend.cpp @@ -112,3 +112,21 @@ namespace test6_2 { vector<A> v(1); } } +namespace test6_3 { + template<class T> + class vector { + public: + vector(int i) {} + void f(const T& t = T()) {} + }; + class A { + public: + private: + friend void vector<A>::f(const A&); + A() {} + }; + void f() { + vector<A> v(1); + v.f(); + } +} |