[cfe-commits] r58377 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/references.cpp

Douglas Gregor doug.gregor at gmail.com
Wed Oct 29 06:50:19 PDT 2008


Author: dgregor
Date: Wed Oct 29 08:50:18 2008
New Revision: 58377

URL: http://llvm.org/viewvc/llvm-project?rev=58377&view=rev
Log:
Temporary disable the const-object-declaration-without-initializer check, because it depends on linkage-specifier semantics we don't yet have

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/SemaCXX/references.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=58377&r1=58376&r2=58377&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Oct 29 08:50:18 2008
@@ -1540,6 +1540,12 @@
            Var->getName(), 
            SourceRange(Var->getLocation(), Var->getLocation()));
 
+#if 0
+    // FIXME: Temporarily disabled because we are not properly parsing
+    // linkage specifications on declarations, e.g., 
+    //
+    //   extern "C" const CGPoint CGPointerZero;
+    //
     // C++ [dcl.init]p9:
     //
     //     If no initializer is specified for an object, and the
@@ -1558,11 +1564,13 @@
     // FIXME: Actually perform the POD/user-defined default
     // constructor check.
     if (getLangOptions().CPlusPlus &&
-             Context.getCanonicalType(Type).isConstQualified())
+        Context.getCanonicalType(Type).isConstQualified() &&
+        Var->getStorageClass() != VarDecl::Extern)
       Diag(Var->getLocation(), 
            diag::err_const_var_requires_init, 
            Var->getName(), 
            SourceRange(Var->getLocation(), Var->getLocation()));
+#endif
   }
 }
 

Modified: cfe/trunk/test/SemaCXX/references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/references.cpp?rev=58377&r1=58376&r2=58377&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/references.cpp (original)
+++ cfe/trunk/test/SemaCXX/references.cpp Wed Oct 29 08:50:18 2008
@@ -61,9 +61,6 @@
 int& test6(int& x) {
   int& yo; // expected-error{{declaration of reference variable 'yo' requires an initializer}}
 
-
-  const int val; // expected-error{{declaration of const variable 'val' requires an initializer}}
-
   return x;
 }
 int& not_initialized_error; // expected-error{{declaration of reference variable 'not_initialized_error' requires an initializer}}





More information about the cfe-commits mailing list