[cfe-commits] r130000 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/PR9460.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Fri Apr 22 10:45:37 PDT 2011
Author: akirtzidis
Date: Fri Apr 22 12:45:37 2011
New Revision: 130000
URL: http://llvm.org/viewvc/llvm-project?rev=130000&view=rev
Log:
In IsUserDefinedConversion try to recover from RequireCompleteType returning true.
Fixes an assertion later on, rdar://9122862 & http://llvm.org/PR9460.
Added:
cfe/trunk/test/SemaCXX/PR9460.cpp
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=130000&r1=129999&r2=130000&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Apr 22 12:45:37 2011
@@ -2230,7 +2230,11 @@
S.IsDerivedFrom(From->getType(), ToType)))
ConstructorsOnly = true;
- if (S.RequireCompleteType(From->getLocStart(), ToType, S.PDiag())) {
+ S.RequireCompleteType(From->getLocStart(), ToType, S.PDiag());
+ // RequireCompleteType may have returned true due to some invalid decl
+ // during template instantiation, but ToType may be complete enough now
+ // to try to recover.
+ if (ToType->isIncompleteType()) {
// We're not going to find any constructors.
} else if (CXXRecordDecl *ToRecordDecl
= dyn_cast<CXXRecordDecl>(ToRecordType->getDecl())) {
Added: cfe/trunk/test/SemaCXX/PR9460.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/PR9460.cpp?rev=130000&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/PR9460.cpp (added)
+++ cfe/trunk/test/SemaCXX/PR9460.cpp Fri Apr 22 12:45:37 2011
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Don't crash.
+
+template<typename aT>
+struct basic_string{
+ a; // expected-error {{requires a type specifier}}
+ basic_string(aT*);
+};
+
+struct runtime_error{
+runtime_error(
+basic_string<char> struct{ // expected-error {{cannot combine with previous 'type-name' declaration specifier}}
+a(){ // expected-error {{requires a type specifier}}
+runtime_error(0);
+}
+}
+);
+};
More information about the cfe-commits
mailing list