diff options
Diffstat (limited to 'test/CodeGenCXX/references.cpp')
-rw-r--r-- | test/CodeGenCXX/references.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/CodeGenCXX/references.cpp b/test/CodeGenCXX/references.cpp index 5a5947dd81..3ae1e474f8 100644 --- a/test/CodeGenCXX/references.cpp +++ b/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 }; + } +} |