[cfe-commits] r120266 - in /cfe/trunk: lib/Sema/SemaAccess.cpp lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaTemplateInstantiateDecl.cpp test/SemaCXX/friend.cpp
Nico Weber
nicolasweber at gmx.de
Sun Nov 28 14:53:37 PST 2010
Author: nico
Date: Sun Nov 28 16:53:37 2010
New Revision: 120266
URL: http://llvm.org/viewvc/llvm-project?rev=120266&view=rev
Log:
Minor whitespace and comment fixes. No functionality change.
Modified:
cfe/trunk/lib/Sema/SemaAccess.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/test/SemaCXX/friend.cpp
Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=120266&r1=120265&r2=120266&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Sun Nov 28 16:53:37 2010
@@ -134,7 +134,7 @@
bool Dependent;
};
-/// Like sema:;AccessedEntity, but kindly lets us scribble all over
+/// Like sema::AccessedEntity, but kindly lets us scribble all over
/// it.
struct AccessTarget : public AccessedEntity {
AccessTarget(const AccessedEntity &Entity)
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=120266&r1=120265&r2=120266&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sun Nov 28 16:53:37 2010
@@ -131,7 +131,7 @@
EqualLoc);
InitializationSequence InitSeq(*this, Entity, Kind, &Arg, 1);
ExprResult Result = InitSeq.Perform(*this, Entity, Kind,
- MultiExprArg(*this, &Arg, 1));
+ MultiExprArg(*this, &Arg, 1));
if (Result.isInvalid())
return true;
Arg = Result.takeAs<Expr>();
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=120266&r1=120265&r2=120266&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Nov 28 16:53:37 2010
@@ -3839,8 +3839,8 @@
}
ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
- FunctionDecl *FD,
- ParmVarDecl *Param) {
+ FunctionDecl *FD,
+ ParmVarDecl *Param) {
if (Param->hasUnparsedDefaultArg()) {
Diag(CallLoc,
diag::err_use_of_default_argument_to_function_declared_later) <<
@@ -3857,12 +3857,20 @@
MultiLevelTemplateArgumentList ArgList
= getTemplateInstantiationArgs(FD, 0, /*RelativeToPrimary=*/true);
- std::pair<const TemplateArgument *, unsigned> Innermost
+ std::pair<const TemplateArgument *, unsigned> Innermost
= ArgList.getInnermost();
InstantiatingTemplate Inst(*this, CallLoc, Param, Innermost.first,
Innermost.second);
- ExprResult Result = SubstExpr(UninstExpr, ArgList);
+ ExprResult Result;
+ {
+ // C++ [dcl.fct.default]p5:
+ // 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());
+ Result = SubstExpr(UninstExpr, ArgList);
+ }
if (Result.isInvalid())
return ExprError();
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=120266&r1=120265&r2=120266&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Sun Nov 28 16:53:37 2010
@@ -2271,7 +2271,7 @@
VarDecl *OldVar = Var;
Var = cast_or_null<VarDecl>(SubstDecl(Def, Var->getDeclContext(),
- getTemplateInstantiationArgs(Var)));
+ getTemplateInstantiationArgs(Var)));
CurContext = PreviousContext;
if (Var) {
Modified: cfe/trunk/test/SemaCXX/friend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/friend.cpp?rev=120266&r1=120265&r2=120266&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/friend.cpp (original)
+++ cfe/trunk/test/SemaCXX/friend.cpp Sun Nov 28 16:53:37 2010
@@ -79,3 +79,36 @@
struct B { friend void B(); };
}
+
+// PR8479
+namespace test6_1 {
+ class A {
+ public:
+ private:
+ friend class vectorA;
+ A() {}
+ };
+ class vectorA {
+ public:
+ vectorA(int i, const A& t = A()) {}
+ };
+ void f() {
+ vectorA v(1);
+ }
+}
+namespace test6_2 {
+ template<class T>
+ class vector {
+ public:
+ vector(int i, const T& t = T()) {}
+ };
+ class A {
+ public:
+ private:
+ friend class vector<A>;
+ A() {}
+ };
+ void f() {
+ vector<A> v(1);
+ }
+}
More information about the cfe-commits
mailing list