summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/references.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-05-16 09:32:51 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-05-16 09:32:51 +0000
commite299ba66f5f8e270f7a0f2f44f90e72ad67ad8a3 (patch)
treec2902b678c618550891be2c6d2f69fb7dde785e7 /clang/test/CodeGenCXX/references.cpp
parent497d83196684ad2b0a6dbe21878e789bdfcef2aa (diff)
downloadbcm5719-llvm-e299ba66f5f8e270f7a0f2f44f90e72ad67ad8a3.tar.gz
bcm5719-llvm-e299ba66f5f8e270f7a0f2f44f90e72ad67ad8a3.zip
When constant folding reference variables with an initializer to the
initializer, don't fold paramters. Their initializers are just default arguments which can be overridden. This fixes some spectacular regressions due to more things making it into the constant folding. llvm-svn: 103904
Diffstat (limited to 'clang/test/CodeGenCXX/references.cpp')
-rw-r--r--clang/test/CodeGenCXX/references.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/references.cpp b/clang/test/CodeGenCXX/references.cpp
index 5a5947dd816..3ae1e474f88 100644
--- a/clang/test/CodeGenCXX/references.cpp
+++ b/clang/test/CodeGenCXX/references.cpp
@@ -155,3 +155,16 @@ void f0(s1 a) { s1 b = a; }
// CHECK: load
// CHECK: ret
const int &f2() { return 0; }
+
+// Don't constant fold const reference parameters with default arguments to
+// their default arguments.
+namespace N1 {
+ const int foo = 1;
+ // CHECK: @_ZN2N14test
+ int test(const int& arg = foo) {
+ // Ensure this array is on the stack where we can set values instead of
+ // being a global constant.
+ // CHECK: %args_array = alloca
+ const int* const args_array[] = { &arg };
+ }
+}
OpenPOWER on IntegriCloud