From: Anders Carlsson Date: Mon, 18 May 2009 19:55:29 +0000 (+0000) Subject: Since we miscompile many cases when declaring a variable with a reference type, make... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cc0e354c92dd1713d7d8f041a8c4e0ca77c1c31b;p=clang Since we miscompile many cases when declaring a variable with a reference type, make them unsupported for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72034 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 9de722e19d..e0ceaf6a2a 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -126,6 +126,11 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) { if (D.getType()->isVariablyModifiedType()) EmitVLASize(D.getType()); + if (D.getType()->isReferenceType()) { + CGM.ErrorUnsupported(&D, "static declaration with reference type"); + return; + } + if (D.getInit()) { llvm::Constant *Init = CGM.EmitConstantExpr(D.getInit(), D.getType(), this); @@ -324,6 +329,11 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { DI->EmitDeclareOfAutoVariable(&D, DeclPtr, Builder); } + if (D.getType()->isReferenceType()) { + CGM.ErrorUnsupported(&D, "declaration with reference type"); + return; + } + // If this local has an initializer, emit it now. if (const Expr *Init = D.getInit()) { llvm::Value *Loc = DeclPtr;