[cfe-commits] r58353 - in /cfe/trunk: include/clang/AST/Expr.h include/clang/Basic/DiagnosticKinds.def include/clang/Parse/Action.h lib/AST/Expr.cpp lib/Parse/ParseDecl.cpp lib/Sema/Sema.h lib/Sema/SemaChecking.cpp lib/Sema/SemaDecl.cpp lib/Sema/

Daniel Dunbar daniel at zuster.org
Tue Oct 28 23:25:41 PDT 2008


On Tue, Oct 28, 2008 at 5:14 PM, Douglas Gregor <doug.gregor at gmail.com>wrote:

>
> +void Sema::ActOnUninitializedDecl(DeclTy *dcl) {
> +  Decl *RealDecl = static_cast<Decl *>(dcl);
> +
> +  if (VarDecl *Var = dyn_cast<VarDecl>(RealDecl)) {
> +    QualType Type = Var->getType();
> +    // C++ [dcl.init.ref]p3:
> +    //   The initializer can be omitted for a reference only in a
> +    //   parameter declaration (8.3.5), in the declaration of a
> +    //   function return type, in the declaration of a class member
> +    //   within its class declaration (9.2), and where the extern
> +    //   specifier is explicitly used.
> +    if (Type->isReferenceType() && Var->getStorageClass() !=
> VarDecl::Extern)
> +      Diag(Var->getLocation(),
> +           diag::err_reference_var_requires_init,
> +           Var->getName(),
> +           SourceRange(Var->getLocation(), Var->getLocation()));
>

This is causing test/SemaCXX/carbon.cpp to fail on OS X (rather verbosely...
we should probably implement a max error count).
I suspect this issue has to do with extern "C" not being handled... can you
investigate?

 - Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20081028/27c08d69/attachment.html>


More information about the cfe-commits mailing list