]> granicus.if.org Git - clang/commitdiff
Temporary disable the const-object-declaration-without-initializer check, because...
authorDouglas Gregor <dgregor@apple.com>
Wed, 29 Oct 2008 13:50:18 +0000 (13:50 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 29 Oct 2008 13:50:18 +0000 (13:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58377 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/SemaCXX/references.cpp

index 78f0d8f8be66309d7775603a389089d1d224b7d8..90fe1ee8a8f519242ccb4d61c32fd77fef8c80ae 100644 (file)
@@ -1540,6 +1540,12 @@ void Sema::ActOnUninitializedDecl(DeclTy *dcl) {
            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 @@ void Sema::ActOnUninitializedDecl(DeclTy *dcl) {
     // 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
   }
 }
 
index eebc3e8f7b3f45b2cc6327f88bd05749ab4fba4e..a127f77c273d16513997953e8be9233408990b97 100644 (file)
@@ -61,9 +61,6 @@ void test5() {
 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}}