diff options
| author | Anders Carlsson <andersca@mac.com> | 2010-02-03 21:58:41 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2010-02-03 21:58:41 +0000 |
| commit | b0695ef01191237910425c7b880075f3ed02fcea (patch) | |
| tree | bb40ba4544ff27d2a52f71c943039d4c34552fe0 /clang/test/CodeGenCXX/member-initializers.cpp | |
| parent | 223084d3ac553a856fea488211048124b45e7df2 (diff) | |
| download | bcm5719-llvm-b0695ef01191237910425c7b880075f3ed02fcea.tar.gz bcm5719-llvm-b0695ef01191237910425c7b880075f3ed02fcea.zip | |
Don't try to fold DeclRefExprs that point to ParmVarDecls. This had the side-effect of always folding the expression to the default argument of the parameter. For example:
void f(int a = 10) {
return a;
}
would always return 10, regardless of the passed in argument.
This fixes another 600 test failures. We're now down to only 137 failures!
llvm-svn: 95262
Diffstat (limited to 'clang/test/CodeGenCXX/member-initializers.cpp')
| -rw-r--r-- | clang/test/CodeGenCXX/member-initializers.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/member-initializers.cpp b/clang/test/CodeGenCXX/member-initializers.cpp index 1a27b7d202d..81dcee7e407 100644 --- a/clang/test/CodeGenCXX/member-initializers.cpp +++ b/clang/test/CodeGenCXX/member-initializers.cpp @@ -20,3 +20,15 @@ int f() { return b.i; } +// Test that we don't try to fold the default value of j when initializing i. +// CHECK: define i32 @_Z9test_foldv() nounwind +int test_fold() { + struct A { + A(const int j = 1) : i(j) { } + int i; + }; + + // CHECK: ret i32 2 + return A(2).i; +} + |

