summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/conditional-expr.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-01-12 23:53:29 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-01-12 23:53:29 +0000
commit8d06f424480e7cd6facd1cea474dfdee5bbcc60d (patch)
tree10b2db660a69a31d4492402fd90748c986e15ba5 /clang/test/SemaCXX/conditional-expr.cpp
parent7840c81df2a766c7174106ae6a6927c9ec26e5e2 (diff)
downloadbcm5719-llvm-8d06f424480e7cd6facd1cea474dfdee5bbcc60d.tar.gz
bcm5719-llvm-8d06f424480e7cd6facd1cea474dfdee5bbcc60d.zip
Improve 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:
- If the declarator is at the start of a line, and the previous line contained another declarator and ended with a comma, then that comma was probably a typo for a semicolon: int n = 0, m = 1, l = 2, // k = 5; myImportantFunctionCall(); // oops! - If removing the parentheses would correctly initialize the object, then produce a note suggesting that fix. - Otherwise, if there is a simple initializer we can suggest which performs value-initialization, then provide a note suggesting a correction to that initializer. Sema::Declarator now tracks the location of the comma prior to the declarator in the declaration, if there is one, to facilitate providing the note. The code to determine an appropriate initializer from the -Wuninitialized warning has been factored out to allow use in both that and -Wvexing-parse. llvm-svn: 148072
Diffstat (limited to 'clang/test/SemaCXX/conditional-expr.cpp')
-rw-r--r--clang/test/SemaCXX/conditional-expr.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/conditional-expr.cpp b/clang/test/SemaCXX/conditional-expr.cpp
index 3cfddb3a416..4aee913277e 100644
--- a/clang/test/SemaCXX/conditional-expr.cpp
+++ b/clang/test/SemaCXX/conditional-expr.cpp
@@ -96,8 +96,8 @@ void test()
(void)(i1 ? BadDerived() : BadBase());
// b2.1 (hierarchy stuff)
- const Base constret(); // expected-warning {{interpreted as a function declaration}}
- const Derived constder(); // expected-warning {{interpreted as a function declaration}}
+ extern const Base constret();
+ extern const Derived constder();
// should use const overload
A a1((i1 ? constret() : Base()).trick());
A a2((i1 ? Base() : constret()).trick());
OpenPOWER on IntegriCloud