]> granicus.if.org Git - clang/commitdiff
improve diagnostics for case when a field type is unknown by
authorChris Lattner <sabre@nondot.org>
Thu, 31 Dec 2009 03:10:55 +0000 (03:10 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 31 Dec 2009 03:10:55 +0000 (03:10 +0000)
not emitting a follow-on error about 'int', which the user
never wrote.  PR5924.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92339 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp
test/SemaCXX/illegal-member-initialization.cpp

index ab90a80cabb9a2d00c629f075bc0ae0853b740b1..f1474cd97971c16ac1e8df2319208e04417793ba 100644 (file)
@@ -1155,7 +1155,8 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args,
     }
     else
       NewExp = (Expr*)Args[0];
-    if (PerformCopyInitialization(NewExp, FieldType, AA_Passing))
+    if (!Member->isInvalidDecl() &&
+        PerformCopyInitialization(NewExp, FieldType, AA_Passing))
       return true;
     Args[0] = NewExp;
   }
index ceefa5d1b78bcb35580b81c6c722318072179fb4..1890dbc9b594d9ab19696a8710dc33b93af4e3f4 100644 (file)
@@ -20,3 +20,13 @@ struct X {
    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.
+};