summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/casts.c3
-rw-r--r--clang/test/Analysis/ptr-arith.c4
-rw-r--r--clang/test/Analysis/stackaddrleak.c4
-rw-r--r--clang/test/Analysis/weak-functions.c2
-rw-r--r--clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp3
-rw-r--r--clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.cpp3
-rw-r--r--clang/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp2
-rw-r--r--clang/test/Sema/const-eval.c2
-rw-r--r--clang/test/Sema/static-init.c2
-rw-r--r--clang/test/SemaCXX/constant-expression-cxx11.cpp2
-rw-r--r--clang/test/SemaCXX/null_in_arithmetic_ops.cpp2
-rw-r--r--clang/test/SemaCXX/nullptr_in_arithmetic_ops.cpp2
-rw-r--r--clang/test/SemaCXX/warn-bool-conversion.cpp96
-rw-r--r--clang/test/SemaCXX/warn-func-as-bool.cpp40
-rw-r--r--clang/test/SemaCXX/warn-tautological-compare.cpp111
-rw-r--r--clang/test/SemaTemplate/resolve-single-template-id.cpp16
16 files changed, 236 insertions, 58 deletions
diff --git a/clang/test/Analysis/casts.c b/clang/test/Analysis/casts.c
index 3e2f8077ede..42c05beb594 100644
--- a/clang/test/Analysis/casts.c
+++ b/clang/test/Analysis/casts.c
@@ -110,7 +110,8 @@ void castsToBool() {
clang_analyzer_eval(symbolicPointer); // expected-warning{{TRUE}}
int localInt;
- clang_analyzer_eval(&localInt); // expected-warning{{TRUE}}
+ int* ptr = &localInt;
+ clang_analyzer_eval(ptr); // expected-warning{{TRUE}}
clang_analyzer_eval(&castsToBool); // expected-warning{{TRUE}}
clang_analyzer_eval("abc"); // expected-warning{{TRUE}}
diff --git a/clang/test/Analysis/ptr-arith.c b/clang/test/Analysis/ptr-arith.c
index 4a15bc24b90..96dc8bacbce 100644
--- a/clang/test/Analysis/ptr-arith.c
+++ b/clang/test/Analysis/ptr-arith.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=alpha.core.FixedAddr,alpha.core.PointerArithm,alpha.core.PointerSub,debug.ExprInspection -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=alpha.core.FixedAddr,alpha.core.PointerArithm,alpha.core.PointerSub,debug.ExprInspection -analyzer-store=region -verify -triple i686-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=alpha.core.FixedAddr,alpha.core.PointerArithm,alpha.core.PointerSub,debug.ExprInspection -analyzer-store=region -verify -triple x86_64-apple-darwin9 -Wno-tautological-pointer-compare %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=alpha.core.FixedAddr,alpha.core.PointerArithm,alpha.core.PointerSub,debug.ExprInspection -analyzer-store=region -verify -triple i686-apple-darwin9 -Wno-tautological-pointer-compare %s
void clang_analyzer_eval(int);
diff --git a/clang/test/Analysis/stackaddrleak.c b/clang/test/Analysis/stackaddrleak.c
index 4f81f6623e5..21a15d75eca 100644
--- a/clang/test/Analysis/stackaddrleak.c
+++ b/clang/test/Analysis/stackaddrleak.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -std=c99 -Dbool=_Bool %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -x c++ %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -std=c99 -Dbool=_Bool -Wno-bool-conversion %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -x c++ -Wno-bool-conversion %s
typedef __INTPTR_TYPE__ intptr_t;
char const *p;
diff --git a/clang/test/Analysis/weak-functions.c b/clang/test/Analysis/weak-functions.c
index 96e3b44d03b..a983f92f81a 100644
--- a/clang/test/Analysis/weak-functions.c
+++ b/clang/test/Analysis/weak-functions.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core,debug.ExprInspection,unix.Malloc,unix.cstring,alpha.unix.cstring,unix.API,osx.API,osx.cocoa.RetainCount -Wno-null-dereference -analyzer-store=region -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core,debug.ExprInspection,unix.Malloc,unix.cstring,alpha.unix.cstring,unix.API,osx.API,osx.cocoa.RetainCount -Wno-null-dereference -Wno-tautological-compare -analyzer-store=region -fblocks -verify %s
#define NULL 0
void clang_analyzer_eval(int);
void myFunc();
diff --git a/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp b/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp
index 9b1727fd04a..de2a76cbc9f 100644
--- a/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp
+++ b/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp
@@ -163,7 +163,8 @@ void shrink_int() {
Agg<bool> b3 = {-1}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
// Conversions from pointers to booleans aren't narrowing conversions.
- Agg<bool> b = {&b1}; // OK
+ Agg<bool>* ptr = &b1;
+ Agg<bool> b = {ptr}; // OK
Agg<short> ce1 = { Convert<int>(100000) }; // expected-error {{constant expression evaluates to 100000 which cannot be narrowed to type 'short'}} expected-note {{override}} expected-warning {{changes value from 100000 to -31072}}
Agg<char> ce2 = { ConvertVar<short>() }; // expected-error {{non-constant-expression cannot be narrowed from type 'short' to 'char'}} expected-note {{override}}
diff --git a/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.cpp b/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.cpp
index 4bcf113d714..cbeae4f0bb0 100644
--- a/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.cpp
+++ b/clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.cpp
@@ -164,7 +164,8 @@ void shrink_int() {
Agg<bool> b3 = {-1}; // expected-warning {{ cannot be narrowed }} expected-note {{override}}
// Conversions from pointers to booleans aren't narrowing conversions.
- Agg<bool> b = {&b1}; // OK
+ Agg<bool>* ptr = &b1;
+ Agg<bool> b = {ptr}; // OK
Agg<short> ce1 = { Convert<int>(100000) }; // expected-warning {{constant expression evaluates to 100000 which cannot be narrowed to type 'short'}} expected-note {{override}} expected-warning {{changes value from 100000 to -31072}}
Agg<char> ce2 = { ConvertVar<short>() }; // expected-warning {{non-constant-expression cannot be narrowed from type 'short' to 'char'}} expected-note {{override}}
diff --git a/clang/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp b/clang/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
index 2646264273e..833a4014e86 100644
--- a/clang/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
+++ b/clang/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
@@ -15,7 +15,7 @@ bool b4 = !E;
bool b5 = !F;
// -- pointer,
-bool b6 = !&b4;
+bool b6 = !&b4; // expected-warning{{address of 'b4' will always evaluate to 'true'}}
void f();
bool b61 = !&f;
diff --git a/clang/test/Sema/const-eval.c b/clang/test/Sema/const-eval.c
index 16d028eaf60..883cced9f3b 100644
--- a/clang/test/Sema/const-eval.c
+++ b/clang/test/Sema/const-eval.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-linux %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-linux %s -Wno-tautological-pointer-compare
#define EVAL_EXPR(testno, expr) int test##testno = sizeof(struct{char qq[expr];});
int x;
diff --git a/clang/test/Sema/static-init.c b/clang/test/Sema/static-init.c
index bbf9038ef38..a2ed55197bc 100644
--- a/clang/test/Sema/static-init.c
+++ b/clang/test/Sema/static-init.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-bool-conversion %s
typedef __typeof((int*) 0 - (int*) 0) intptr_t;
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp
index 6724be7c820..4e617776439 100644
--- a/clang/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i686-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -fsyntax-only -fcxx-exceptions -verify -std=c++11 -pedantic %s -Wno-comment
+// RUN: %clang_cc1 -triple i686-linux -Wno-string-plus-int -Wno-pointer-arith -Wno-zero-length-array -fsyntax-only -fcxx-exceptions -verify -std=c++11 -pedantic %s -Wno-comment -Wno-tautological-pointer-compare -Wno-bool-conversion
namespace StaticAssertFoldTest {
diff --git a/clang/test/SemaCXX/null_in_arithmetic_ops.cpp b/clang/test/SemaCXX/null_in_arithmetic_ops.cpp
index a919213fb20..3b42ab44feb 100644
--- a/clang/test/SemaCXX/null_in_arithmetic_ops.cpp
+++ b/clang/test/SemaCXX/null_in_arithmetic_ops.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -fblocks -Wnull-arithmetic -verify -Wno-string-plus-int %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -fblocks -Wnull-arithmetic -verify -Wno-string-plus-int -Wno-tautological-pointer-compare %s
#include <stddef.h>
void f() {
diff --git a/clang/test/SemaCXX/nullptr_in_arithmetic_ops.cpp b/clang/test/SemaCXX/nullptr_in_arithmetic_ops.cpp
index 9671353907c..60b4670b3a5 100644
--- a/clang/test/SemaCXX/nullptr_in_arithmetic_ops.cpp
+++ b/clang/test/SemaCXX/nullptr_in_arithmetic_ops.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fblocks -std=c++11 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-tautological-pointer-compare -fblocks -std=c++11 -verify %s
void foo() {
int a;
diff --git a/clang/test/SemaCXX/warn-bool-conversion.cpp b/clang/test/SemaCXX/warn-bool-conversion.cpp
index b3d136ecf2b..b4628947f06 100644
--- a/clang/test/SemaCXX/warn-bool-conversion.cpp
+++ b/clang/test/SemaCXX/warn-bool-conversion.cpp
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+namespace BooleanFalse {
int* j = false; // expected-warning{{initialization of pointer of type 'int *' to null from a constant boolean expression}}
void foo(int* i, int *j=(false)) // expected-warning{{initialization of pointer of type 'int *' to null from a constant boolean expression}}
@@ -22,3 +23,98 @@ double f(...);
// isn't flagged.
template <int N> struct S {};
S<sizeof(f(false))> s;
+
+}
+
+namespace Function {
+void f1();
+
+struct S {
+ static void f2();
+};
+
+extern void f3() __attribute__((weak_import));
+
+struct S2 {
+ static void f4() __attribute__((weak_import));
+};
+
+bool f5();
+bool f6(int);
+
+void bar() {
+ bool b;
+
+ b = f1; // expected-warning {{address of function 'f1' will always evaluate to 'true'}} \
+ expected-note {{prefix with the address-of operator to silence this warning}}
+ if (f1) {} // expected-warning {{address of function 'f1' will always evaluate to 'true'}} \
+ expected-note {{prefix with the address-of operator to silence this warning}}
+ b = S::f2; // expected-warning {{address of function 'S::f2' will always evaluate to 'true'}} \
+ expected-note {{prefix with the address-of operator to silence this warning}}
+ if (S::f2) {} // expected-warning {{address of function 'S::f2' will always evaluate to 'true'}} \
+ expected-note {{prefix with the address-of operator to silence this warning}}
+ b = f5; // expected-warning {{address of function 'f5' will always evaluate to 'true'}} \
+ expected-note {{prefix with the address-of operator to silence this warning}} \
+ expected-note {{suffix with parentheses to turn this into a function call}}
+ b = f6; // expected-warning {{address of function 'f6' will always evaluate to 'true'}} \
+ expected-note {{prefix with the address-of operator to silence this warning}}
+
+ // implicit casts of weakly imported symbols are ok:
+ b = f3;
+ if (f3) {}
+ b = S2::f4;
+ if (S2::f4) {}
+}
+}
+
+namespace Array {
+ #define GetValue(ptr) ((ptr) ? ptr[0] : 0)
+ extern int a[] __attribute__((weak));
+ int b[] = {8,13,21};
+ struct {
+ int x[10];
+ } c;
+ const char str[] = "text";
+ void ignore() {
+ if (a) {}
+ if (a) {}
+ (void)GetValue(b);
+ }
+ void test() {
+ if (b) {}
+ // expected-warning@-1{{address of array 'b' will always evaluate to 'true'}}
+ if (b) {}
+ // expected-warning@-1{{address of array 'b' will always evaluate to 'true'}}
+ if (c.x) {}
+ // expected-warning@-1{{address of array 'c.x' will always evaluate to 'true'}}
+ if (str) {}
+ // expected-warning@-1{{address of array 'str' will always evaluate to 'true'}}
+ }
+}
+
+namespace Pointer {
+ extern int a __attribute__((weak));
+ int b;
+ static int c;
+ class S {
+ public:
+ static int a;
+ int b;
+ };
+ void ignored() {
+ if (&a) {}
+ }
+ void test() {
+ S s;
+ if (&b) {}
+ // expected-warning@-1{{address of 'b' will always evaluate to 'true'}}
+ if (&c) {}
+ // expected-warning@-1{{address of 'c' will always evaluate to 'true'}}
+ if (&s.a) {}
+ // expected-warning@-1{{address of 's.a' will always evaluate to 'true'}}
+ if (&s.b) {}
+ // expected-warning@-1{{address of 's.b' will always evaluate to 'true'}}
+ if (&S::a) {}
+ // expected-warning@-1{{address of 'S::a' will always evaluate to 'true'}}
+ }
+}
diff --git a/clang/test/SemaCXX/warn-func-as-bool.cpp b/clang/test/SemaCXX/warn-func-as-bool.cpp
deleted file mode 100644
index b5df744f930..00000000000
--- a/clang/test/SemaCXX/warn-func-as-bool.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// RUN: %clang_cc1 -x c++ -verify -fsyntax-only %s
-
-void f1();
-
-struct S {
- static void f2();
-};
-
-extern void f3() __attribute__((weak_import));
-
-struct S2 {
- static void f4() __attribute__((weak_import));
-};
-
-bool f5();
-bool f6(int);
-
-void bar() {
- bool b;
-
- b = f1; // expected-warning {{address of function 'f1' will always evaluate to 'true'}} \
- expected-note {{prefix with the address-of operator to silence this warning}}
- if (f1) {} // expected-warning {{address of function 'f1' will always evaluate to 'true'}} \
- expected-note {{prefix with the address-of operator to silence this warning}}
- b = S::f2; // expected-warning {{address of function 'S::f2' will always evaluate to 'true'}} \
- expected-note {{prefix with the address-of operator to silence this warning}}
- if (S::f2) {} // expected-warning {{address of function 'S::f2' will always evaluate to 'true'}} \
- expected-note {{prefix with the address-of operator to silence this warning}}
- b = f5; // expected-warning {{address of function 'f5' will always evaluate to 'true'}} \
- expected-note {{prefix with the address-of operator to silence this warning}} \
- expected-note {{suffix with parentheses to turn this into a function call}}
- b = f6; // expected-warning {{address of function 'f6' will always evaluate to 'true'}} \
- expected-note {{prefix with the address-of operator to silence this warning}}
-
- // implicit casts of weakly imported symbols are ok:
- b = f3;
- if (f3) {}
- b = S2::f4;
- if (S2::f4) {}
-}
diff --git a/clang/test/SemaCXX/warn-tautological-compare.cpp b/clang/test/SemaCXX/warn-tautological-compare.cpp
index caea6bf86e0..b44f3f9d8fa 100644
--- a/clang/test/SemaCXX/warn-tautological-compare.cpp
+++ b/clang/test/SemaCXX/warn-tautological-compare.cpp
@@ -25,3 +25,114 @@ namespace RuntimeBehavior {
if (x < kintmax) {}
}
}
+
+namespace ArrayCompare {
+ #define GetValue(ptr) ((ptr != 0) ? ptr[0] : 0)
+ extern int a[] __attribute__((weak));
+ int b[] = {8,13,21};
+ struct {
+ int x[10];
+ } c;
+ const char str[] = "text";
+ void ignore() {
+ if (a == 0) {}
+ if (a != 0) {}
+ (void)GetValue(b);
+ }
+ void test() {
+ if (b == 0) {}
+ // expected-warning@-1{{comparison of array 'b' equal to a null pointer is always false}}
+ if (b != 0) {}
+ // expected-warning@-1{{comparison of array 'b' not equal to a null pointer is always true}}
+ if (0 == b) {}
+ // expected-warning@-1{{comparison of array 'b' equal to a null pointer is always false}}
+ if (0 != b) {}
+ // expected-warning@-1{{comparison of array 'b' not equal to a null pointer is always true}}
+ if (c.x == 0) {}
+ // expected-warning@-1{{comparison of array 'c.x' equal to a null pointer is always false}}
+ if (c.x != 0) {}
+ // expected-warning@-1{{comparison of array 'c.x' not equal to a null pointer is always true}}
+ if (str == 0) {}
+ // expected-warning@-1{{comparison of array 'str' equal to a null pointer is always false}}
+ if (str != 0) {}
+ // expected-warning@-1{{comparison of array 'str' not equal to a null pointer is always true}}
+ }
+}
+
+namespace FunctionCompare {
+ #define CallFunction(f) ((f != 0) ? f() : 0)
+ extern void a() __attribute__((weak));
+ void fun1();
+ int fun2();
+ int* fun3();
+ int* fun4(int);
+ class S {
+ public:
+ static int foo();
+ };
+ void ignore() {
+ if (a == 0) {}
+ if (0 != a) {}
+ (void)CallFunction(fun2);
+ }
+ void test() {
+ if (fun1 == 0) {}
+ // expected-warning@-1{{comparison of function 'fun1' equal to a null pointer is always false}}
+ // expected-note@-2{{prefix with the address-of operator to silence this warning}}
+ if (fun2 == 0) {}
+ // expected-warning@-1{{comparison of function 'fun2' equal to a null pointer is always false}}
+ // expected-note@-2{{prefix with the address-of operator to silence this warning}}
+ // expected-note@-3{{suffix with parentheses to turn this into a function call}}
+ if (fun3 == 0) {}
+ // expected-warning@-1{{comparison of function 'fun3' equal to a null pointer is always false}}
+ // expected-note@-2{{prefix with the address-of operator to silence this warning}}
+ // expected-note@-3{{suffix with parentheses to turn this into a function call}}
+ if (fun4 == 0) {}
+ // expected-warning@-1{{comparison of function 'fun4' equal to a null pointer is always false}}
+ // expected-note@-2{{prefix with the address-of operator to silence this warning}}
+ if (nullptr != fun1) {}
+ // expected-warning@-1{{comparison of function 'fun1' not equal to a null pointer is always true}}
+ // expected-note@-2{{prefix with the address-of operator to silence this warning}}
+ if (nullptr != fun2) {}
+ // expected-warning@-1{{comparison of function 'fun2' not equal to a null pointer is always true}}
+ // expected-note@-2{{prefix with the address-of operator to silence this warning}}
+ if (nullptr != fun3) {}
+ // expected-warning@-1{{comparison of function 'fun3' not equal to a null pointer is always true}}
+ // expected-note@-2{{prefix with the address-of operator to silence this warning}}
+ // expected-note@-3{{suffix with parentheses to turn this into a function call}}
+ if (nullptr != fun4) {}
+ // expected-warning@-1{{comparison of function 'fun4' not equal to a null pointer is always true}}
+ // expected-note@-2{{prefix with the address-of operator to silence this warning}}
+ if (S::foo == 0) {}
+ // expected-warning@-1{{comparison of function 'S::foo' equal to a null pointer is always false}}
+ // expected-note@-2{{prefix with the address-of operator to silence this warning}}
+ // expected-note@-3{{suffix with parentheses to turn this into a function call}}
+ }
+}
+
+namespace PointerCompare {
+ extern int a __attribute__((weak));
+ int b;
+ static int c;
+ class S {
+ public:
+ static int a;
+ int b;
+ };
+ void ignored() {
+ if (&a == 0) {}
+ }
+ void test() {
+ S s;
+ if (&b == 0) {}
+ // expected-warning@-1{{comparison of address of 'b' equal to a null pointer is always false}}
+ if (&c == 0) {}
+ // expected-warning@-1{{comparison of address of 'c' equal to a null pointer is always false}}
+ if (&s.a == 0) {}
+ // expected-warning@-1{{comparison of address of 's.a' equal to a null pointer is always false}}
+ if (&s.b == 0) {}
+ // expected-warning@-1{{comparison of address of 's.b' equal to a null pointer is always false}}
+ if (&S::a == 0) {}
+ // expected-warning@-1{{comparison of address of 'S::a' equal to a null pointer is always false}}
+ }
+}
diff --git a/clang/test/SemaTemplate/resolve-single-template-id.cpp b/clang/test/SemaTemplate/resolve-single-template-id.cpp
index 7fb16eb4674..915c42c85a6 100644
--- a/clang/test/SemaTemplate/resolve-single-template-id.cpp
+++ b/clang/test/SemaTemplate/resolve-single-template-id.cpp
@@ -45,9 +45,15 @@ int main()
+oneT<int>; // expected-warning {{expression result unused}}
-oneT<int>; //expected-error {{invalid argument type}}
oneT<int> == 0; // expected-warning {{equality comparison result unused}} \
- // expected-note {{use '=' to turn this equality comparison into an assignment}}
- 0 == oneT<int>; // expected-warning {{equality comparison result unused}}
- 0 != oneT<int>; // expected-warning {{inequality comparison result unused}}
+ // expected-note {{use '=' to turn this equality comparison into an assignment}} \
+ // expected-warning {{comparison of function 'oneT<int>' equal to a null pointer is always false}} \
+ // expected-note {{prefix with the address-of operator to silence this warning}}
+ 0 == oneT<int>; // expected-warning {{equality comparison result unused}} \
+ // expected-warning {{comparison of function 'oneT<int>' equal to a null pointer is always false}} \
+ // expected-note {{prefix with the address-of operator to silence this warning}}
+ 0 != oneT<int>; // expected-warning {{inequality comparison result unused}} \
+ // expected-warning {{comparison of function 'oneT<int>' not equal to a null pointer is always true}} \
+ // expected-note {{prefix with the address-of operator to silence this warning}}
(false ? one : oneT<int>); // expected-warning {{expression result unused}}
void (*p1)(int); p1 = oneT<int>;
@@ -69,7 +75,9 @@ int main()
two < two; //expected-error 2 {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} expected-error {{invalid operands to binary expression ('void' and 'void')}}
twoT<int> < twoT<int>; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} {{cannot resolve overloaded function 'twoT' from context}}
oneT<int> == 0; // expected-warning {{equality comparison result unused}} \
- // expected-note {{use '=' to turn this equality comparison into an assignment}}
+ // expected-note {{use '=' to turn this equality comparison into an assignment}} \
+ // expected-warning {{comparison of function 'oneT<int>' equal to a null pointer is always false}} \
+ // expected-note {{prefix with the address-of operator to silence this warning}}
}
OpenPOWER on IntegriCloud