diff options
| author | Lang Hames <lhames@gmail.com> | 2011-12-05 20:49:50 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2011-12-05 20:49:50 +0000 |
| commit | df5c121f8ed83da0df666734860762241ee450ca (patch) | |
| tree | 17d4b75aea26f96167b8fac54fcb451a1ff8e1fa /clang/test/SemaTemplate | |
| parent | ab7940f6e1ae76a6eb8adf64babf3563c9550830 (diff) | |
| download | bcm5719-llvm-df5c121f8ed83da0df666734860762241ee450ca.tar.gz bcm5719-llvm-df5c121f8ed83da0df666734860762241ee450ca.zip | |
Add a warning for implicit conversion from function literals (and static
methods) to bool. E.g.
void foo() {}
if (f) { ... // <- Warns here.
}
Only applies to non-weak functions, and does not apply if the function address
is taken explicitly with the addr-of operator.
llvm-svn: 145849
Diffstat (limited to 'clang/test/SemaTemplate')
| -rw-r--r-- | clang/test/SemaTemplate/resolve-single-template-id.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/SemaTemplate/resolve-single-template-id.cpp b/clang/test/SemaTemplate/resolve-single-template-id.cpp index b9833d8609e..1beb65a0f51 100644 --- a/clang/test/SemaTemplate/resolve-single-template-id.cpp +++ b/clang/test/SemaTemplate/resolve-single-template-id.cpp @@ -41,7 +41,7 @@ int main() *oneT<int>; // expected-warning {{expression result unused}} *two; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} expected-error {{indirection requires pointer operand}} *twoT<int>; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} - !oneT<int>; // expected-warning {{expression result unused}} + !oneT<int>; // expected-warning {{expression result unused}} expected-warning {{address of function 'oneT<int>' will always evaluate to 'true'}} +oneT<int>; // expected-warning {{expression result unused}} -oneT<int>; //expected-error {{invalid argument type}} oneT<int> == 0; // expected-warning {{equality comparison result unused}} \ @@ -53,7 +53,7 @@ int main() int i = (int) (false ? (void (*)(int))twoT<int> : oneT<int>); //expected-error {{incompatible operand}} (twoT<int>) == oneT<int>; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} {{cannot resolve overloaded function 'twoT' from context}} - bool b = oneT<int>; + bool b = oneT<int>; // expected-warning {{address of function 'oneT<int>' will always evaluate to 'true'}} void (*p)() = oneT<int>; test<oneT<int> > ti; void (*u)(int) = oneT<int>; |

