]> granicus.if.org Git - clang/commitdiff
Since we miscompile many cases when declaring a variable with a reference type, make...
authorAnders Carlsson <andersca@mac.com>
Mon, 18 May 2009 19:55:29 +0000 (19:55 +0000)
committerAnders Carlsson <andersca@mac.com>
Mon, 18 May 2009 19:55:29 +0000 (19:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72034 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDecl.cpp

index 9de722e19d186d6af2d9cc70e4b5346c42fd8b9b..e0ceaf6a2a9ca590af6e9f5b76863636c5986583 100644 (file)
@@ -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;