[cfe-commits] r89653 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaTemplate/current-instantiation.cpp
Douglas Gregor
dgregor at apple.com
Mon Nov 23 04:39:54 PST 2009
Author: dgregor
Date: Mon Nov 23 06:39:54 2009
New Revision: 89653
URL: http://llvm.org/viewvc/llvm-project?rev=89653&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaTemplate/current-instantiation.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=89653&r1=89652&r2=89653&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Nov 23 06:39:54 2009
@@ -673,12 +673,8 @@
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()),
Modified: cfe/trunk/test/SemaTemplate/current-instantiation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/current-instantiation.cpp?rev=89653&r1=89652&r2=89653&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/current-instantiation.cpp (original)
+++ cfe/trunk/test/SemaTemplate/current-instantiation.cpp Mon Nov 23 06:39:54 2009
@@ -142,3 +142,12 @@
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;
+ }
+};
More information about the cfe-commits
mailing list