[cfe-commits] r111293 - in /cfe/trunk: lib/Sema/TreeTransform.h test/SemaTemplate/instantiate-declref.cpp
John McCall
rjmccall at apple.com
Tue Aug 17 14:27:17 PDT 2010
Author: rjmccall
Date: Tue Aug 17 16:27:17 2010
New Revision: 111293
URL: http://llvm.org/viewvc/llvm-project?rev=111293&view=rev
Log:
Implicit decl ref expressions might not have name locations; don't silently
fail to instantiate them.
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/SemaTemplate/instantiate-declref.cpp
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=111293&r1=111292&r2=111293&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Tue Aug 17 16:27:17 2010
@@ -4214,10 +4214,12 @@
if (!ND)
return SemaRef.ExprError();
- DeclarationNameInfo NameInfo
- = getDerived().TransformDeclarationNameInfo(E->getNameInfo());
- if (!NameInfo.getName())
- return SemaRef.ExprError();
+ DeclarationNameInfo NameInfo = E->getNameInfo();
+ if (NameInfo.getName()) {
+ NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
+ if (!NameInfo.getName())
+ return SemaRef.ExprError();
+ }
if (!getDerived().AlwaysRebuild() &&
Qualifier == E->getQualifier() &&
Modified: cfe/trunk/test/SemaTemplate/instantiate-declref.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-declref.cpp?rev=111293&r1=111292&r2=111293&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-declref.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-declref.cpp Tue Aug 17 16:27:17 2010
@@ -95,3 +95,13 @@
};
void g() { X<2>(); }
}
+
+// <rdar://problem/8302161>
+namespace test1 {
+ template <typename T> void f(T const &t) {
+ union { char c; T t_; };
+ c = 'a'; // <- this shouldn't silently fail to instantiate
+ T::foo(); // expected-error {{has no members}}
+ }
+ template void f(int const &); // expected-note {{requested here}}
+}
More information about the cfe-commits
mailing list