diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-09-11 05:16:22 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-09-11 05:16:22 +0000 |
commit | 176edb54908d7cf76650e672dbe147e0347cf38c (patch) | |
tree | d8721e8d19d205643d617f2a0a1c0eb40ad52851 /clang/test/SemaCXX/condition.cpp | |
parent | fea38016a92ea2afc6ab1b87ffeaac3f3aa03fe7 (diff) | |
download | bcm5719-llvm-176edb54908d7cf76650e672dbe147e0347cf38c.tar.gz bcm5719-llvm-176edb54908d7cf76650e672dbe147e0347cf38c.zip |
Do implicit conversion to bool for the condition in a do-while statement.
llvm-svn: 56096
Diffstat (limited to 'clang/test/SemaCXX/condition.cpp')
-rw-r--r-- | clang/test/SemaCXX/condition.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/condition.cpp b/clang/test/SemaCXX/condition.cpp index 59cc61ca9a4..b2f716f8840 100644 --- a/clang/test/SemaCXX/condition.cpp +++ b/clang/test/SemaCXX/condition.cpp @@ -12,6 +12,8 @@ void test() { struct S {} s; if (s) ++x; // expected-error: {{expression must have bool type (or be convertible to bool) ('struct S' invalid)}} while (struct S x=s) ; // expected-error: {{expression must have bool type (or be convertible to bool) ('struct S' invalid)}} + do ; while (s); // expected-error: {{expression must have bool type (or be convertible to bool) ('struct S' invalid)}} + for (;s;) ; // expected-error: {{expression must have bool type (or be convertible to bool) ('struct S' invalid)}} switch (s) {} // expected-error: {{statement requires expression of integer type ('struct S' invalid)}} while (struct S {} x=0) ; // expected-error: {{types may not be defined in conditions}} expected-error: {{incompatible type}} expected-error: {{expression must have bool type}} |