[cfe-commits] r102165 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/constructor-initializer.cpp

Anders Carlsson andersca at mac.com
Thu Apr 22 20:07:47 PDT 2010


Author: andersca
Date: Thu Apr 22 22:07:47 2010
New Revision: 102165

URL: http://llvm.org/viewvc/llvm-project?rev=102165&view=rev
Log:
Fix a think-o that broke self-host.

Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/SemaCXX/constructor-initializer.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=102165&r1=102164&r2=102165&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Apr 22 22:07:47 2010
@@ -1471,26 +1471,6 @@
   QualType FieldBaseElementType = 
     SemaRef.Context.getBaseElementType(Field->getType());
   
-  if (FieldBaseElementType->isReferenceType()) {
-    SemaRef.Diag(Constructor->getLocation(), 
-                 diag::err_uninitialized_member_in_ctor)
-      << (int)Constructor->isImplicit() 
-      << SemaRef.Context.getTagDeclType(Constructor->getParent())
-      << 0 << Field->getDeclName();
-    SemaRef.Diag(Field->getLocation(), diag::note_declared_at);
-    return true;
-  }
-
-  if (FieldBaseElementType.isConstQualified()) {
-    SemaRef.Diag(Constructor->getLocation(), 
-                 diag::err_uninitialized_member_in_ctor)
-      << (int)Constructor->isImplicit() 
-      << SemaRef.Context.getTagDeclType(Constructor->getParent())
-      << 1 << Field->getDeclName();
-    SemaRef.Diag(Field->getLocation(), diag::note_declared_at);
-    return true;
-  }
-
   if (FieldBaseElementType->isRecordType()) {
     InitializedEntity InitEntity = InitializedEntity::InitializeMember(Field);
     InitializationKind InitKind
@@ -1512,6 +1492,26 @@
                                                        SourceLocation());
     return false;
   }
+
+  if (FieldBaseElementType->isReferenceType()) {
+    SemaRef.Diag(Constructor->getLocation(), 
+                 diag::err_uninitialized_member_in_ctor)
+    << (int)Constructor->isImplicit() 
+    << SemaRef.Context.getTagDeclType(Constructor->getParent())
+    << 0 << Field->getDeclName();
+    SemaRef.Diag(Field->getLocation(), diag::note_declared_at);
+    return true;
+  }
+
+  if (FieldBaseElementType.isConstQualified()) {
+    SemaRef.Diag(Constructor->getLocation(), 
+                 diag::err_uninitialized_member_in_ctor)
+    << (int)Constructor->isImplicit() 
+    << SemaRef.Context.getTagDeclType(Constructor->getParent())
+    << 1 << Field->getDeclName();
+    SemaRef.Diag(Field->getLocation(), diag::note_declared_at);
+    return true;
+  }
   
   // Nothing to initialize.
   CXXMemberInit = 0;

Modified: cfe/trunk/test/SemaCXX/constructor-initializer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constructor-initializer.cpp?rev=102165&r1=102164&r2=102165&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/constructor-initializer.cpp (original)
+++ cfe/trunk/test/SemaCXX/constructor-initializer.cpp Thu Apr 22 22:07:47 2010
@@ -171,3 +171,14 @@
   
   NDC<int> ndc;
 };
+
+namespace Test0 {
+
+struct A { A(); };
+
+struct B {
+  B() { } 
+  const A a;
+};
+
+}





More information about the cfe-commits mailing list