[cfe-commits] r92339 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/illegal-member-initialization.cpp
Chris Lattner
sabre at nondot.org
Wed Dec 30 19:10:55 PST 2009
Author: lattner
Date: Wed Dec 30 21:10:55 2009
New Revision: 92339
URL: http://llvm.org/viewvc/llvm-project?rev=92339&view=rev
Log:
improve diagnostics for case when a field type is unknown by
not emitting a follow-on error about 'int', which the user
never wrote. PR5924.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/illegal-member-initialization.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=92339&r1=92338&r2=92339&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Dec 30 21:10:55 2009
@@ -1155,7 +1155,8 @@
}
else
NewExp = (Expr*)Args[0];
- if (PerformCopyInitialization(NewExp, FieldType, AA_Passing))
+ if (!Member->isInvalidDecl() &&
+ PerformCopyInitialization(NewExp, FieldType, AA_Passing))
return true;
Args[0] = NewExp;
}
Modified: cfe/trunk/test/SemaCXX/illegal-member-initialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/illegal-member-initialization.cpp?rev=92339&r1=92338&r2=92339&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/illegal-member-initialization.cpp (original)
+++ cfe/trunk/test/SemaCXX/illegal-member-initialization.cpp Wed Dec 30 21:10:55 2009
@@ -20,3 +20,13 @@
B& b; // expected-note{{declared at}}
const B cb; // expected-note{{declared at}}
};
+
+
+// PR5924
+struct bar {};
+bar xxx();
+
+struct foo {
+ foo_t a; // expected-error {{unknown type name 'foo_t'}}
+ foo() : a(xxx()) {} // no error here.
+};
More information about the cfe-commits
mailing list