diff options
author | John McCall <rjmccall@apple.com> | 2010-05-06 08:58:33 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-05-06 08:58:33 +0000 |
commit | cc7e5bff5c8095fe431327724d227f11b7fb0150 (patch) | |
tree | 4e41052cfa7cda39c0b57ce7c7d89da70499ca25 /clang/test/SemaCXX/conditional-expr.cpp | |
parent | 9aa35bed4584d99347843a45e7209e46c1829412 (diff) | |
download | bcm5719-llvm-cc7e5bff5c8095fe431327724d227f11b7fb0150.tar.gz bcm5719-llvm-cc7e5bff5c8095fe431327724d227f11b7fb0150.zip |
Rearchitect -Wconversion and -Wsign-compare. Instead of computing them
"bottom-up" when implicit casts and comparisons are inserted, compute them
"top-down" when the full expression is finished. Makes it easier to
coordinate warnings and thus implement -Wconversion for signedness
conversions without double-warning with -Wsign-compare. Also makes it possible
to realize that a signedness conversion is okay because the context is
performing the inverse conversion. Also simplifies some logic that was
trying to calculate the ultimate comparison/result type and getting it wrong.
Also fixes a problem with the C++ explicit casts which are often "implemented"
in the AST with a series of implicit cast expressions.
llvm-svn: 103174
Diffstat (limited to 'clang/test/SemaCXX/conditional-expr.cpp')
-rw-r--r-- | clang/test/SemaCXX/conditional-expr.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/conditional-expr.cpp b/clang/test/SemaCXX/conditional-expr.cpp index a812a5920d6..f1fe8ba79bb 100644 --- a/clang/test/SemaCXX/conditional-expr.cpp +++ b/clang/test/SemaCXX/conditional-expr.cpp @@ -238,3 +238,20 @@ namespace PR6757 { (void)(true ? Bar() : Foo3()); // expected-error{{no viable constructor copying temporary}} } } + +// Reduced from selfhost. +namespace test1 { + struct A { + enum Foo { + fa, fb, fc, fd, fe, ff + }; + + Foo x(); + }; + + void foo(int); + + void test(A *a) { + foo(a ? a->x() : 0); + } +} |