aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-23 12:39:54 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-23 12:39:54 +0000
commitac564f3e8d79c44fefa5da5ab1b58484ae781051 (patch)
treea31b3d8456938a7b722b2988789a5b140dc283ab
parent7edfb69ae192d9c1f5b1f32af30130f34f98386e (diff)
Improve type-checking of templates by distinguishing between members
of the current instantiation and members of an unknown specialization when type-checking a qualified-if expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89653 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp8
-rw-r--r--test/SemaTemplate/current-instantiation.cpp9
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 1506fbaf60..d32b3a97cd 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -673,12 +673,8 @@ Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc,
if (SS && SS->isInvalid())
return ExprError();
- // C++ [temp.dep.expr]p3:
- // An id-expression is type-dependent if it contains:
- // -- a nested-name-specifier that contains a class-name that
- // names a dependent type.
- // FIXME: Member of the current instantiation.
- if (SS && isDependentScopeSpecifier(*SS)) {
+ // Determine whether this is a member of an unknown specialization.
+ if (SS && SS->isSet() && !computeDeclContext(*SS, false)) {
return Owned(new (Context) DependentScopeDeclRefExpr(Name, Context.DependentTy,
Loc, SS->getRange(),
static_cast<NestedNameSpecifier *>(SS->getScopeRep()),
diff --git a/test/SemaTemplate/current-instantiation.cpp b/test/SemaTemplate/current-instantiation.cpp
index a1d9fcb537..fe2c558a3d 100644
--- a/test/SemaTemplate/current-instantiation.cpp
+++ b/test/SemaTemplate/current-instantiation.cpp
@@ -142,3 +142,12 @@ struct X0<T*, U*> {
void g8(typename ::X0<typename X0<T_type*, U*>::X2::my_T_type*, U_type*>::X2::my_T_type&); // expected-error{{redecl}}
};
};
+
+template<typename T>
+struct X1 {
+ static int *a;
+ void f(float *b) {
+ X1<T>::a = b; // expected-error{{incompatible}}
+ X1<T*>::a = b;
+ }
+};