Temporary disable the const-object-declaration-without-initializer check, because it depends on linkage-specifier semantics we don't yet have

llvm-svn: 58377
This commit is contained in:
Douglas Gregor 2008-10-29 13:50:18 +00:00
parent b3a36cf86a
commit 9774aa13c7
2 changed files with 9 additions and 4 deletions

View File

@ -1540,6 +1540,12 @@ void Sema::ActOnUninitializedDecl(DeclTy *dcl) {
Var->getName(), Var->getName(),
SourceRange(Var->getLocation(), Var->getLocation())); 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: // C++ [dcl.init]p9:
// //
// If no initializer is specified for an object, and the // 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 // FIXME: Actually perform the POD/user-defined default
// constructor check. // constructor check.
if (getLangOptions().CPlusPlus && if (getLangOptions().CPlusPlus &&
Context.getCanonicalType(Type).isConstQualified()) Context.getCanonicalType(Type).isConstQualified() &&
Var->getStorageClass() != VarDecl::Extern)
Diag(Var->getLocation(), Diag(Var->getLocation(),
diag::err_const_var_requires_init, diag::err_const_var_requires_init,
Var->getName(), Var->getName(),
SourceRange(Var->getLocation(), Var->getLocation())); SourceRange(Var->getLocation(), Var->getLocation()));
#endif
} }
} }

View File

@ -61,9 +61,6 @@ void test5() {
int& test6(int& x) { int& test6(int& x) {
int& yo; // expected-error{{declaration of reference variable 'yo' requires an initializer}} 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; return x;
} }
int& not_initialized_error; // expected-error{{declaration of reference variable 'not_initialized_error' requires an initializer}} int& not_initialized_error; // expected-error{{declaration of reference variable 'not_initialized_error' requires an initializer}}