]> granicus.if.org Git - clang/commitdiff
Fix thunk generation for thunks with a parameter with reference type.
authorEli Friedman <eli.friedman@gmail.com>
Thu, 3 Dec 2009 04:49:52 +0000 (04:49 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 3 Dec 2009 04:49:52 +0000 (04:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90412 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCXX.cpp
test/CodeGenCXX/virt-thunk-reference.cpp [new file with mode: 0644]

index 77d3a3eb4254ca1b576f62067780d3208ba21bed..636cc57b2a505c94c6ac753abddef0dc20cce563 100644 (file)
@@ -940,7 +940,8 @@ CodeGenFunction::GenerateCovariantThunk(llvm::Function *Fn,
     QualType ArgType = D->getType();
 
     // llvm::Value *Arg = CGF.GetAddrOfLocalVar(Dst);
-    Expr *Arg = new (getContext()) DeclRefExpr(D, ArgType, SourceLocation());
+    Expr *Arg = new (getContext()) DeclRefExpr(D, ArgType.getNonReferenceType(),
+                                               SourceLocation());
     CallArgs.push_back(std::make_pair(EmitCallArg(Arg, ArgType), ArgType));
   }
 
diff --git a/test/CodeGenCXX/virt-thunk-reference.cpp b/test/CodeGenCXX/virt-thunk-reference.cpp
new file mode 100644 (file)
index 0000000..4b361cf
--- /dev/null
@@ -0,0 +1,7 @@
+// RUN: clang-cc -emit-llvm-only %s
+
+struct A { int a; virtual void aa(int&); };
+struct B { int b; virtual void bb(int&); };
+struct C : A,B { virtual void aa(int&), bb(int&); };
+void C::aa(int&) {}
+void C::bb(int&) {}