[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaTemplate / self-comparison.cpp
blob50ab660e651b9b9f5eeafcd6abc52cafd05a35aa
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 template <int A, int B> void foo() {
4 (void)(A == A); // expected-warning {{self-comparison always evaluates to true}}
5 (void)(A == B);
7 template <int A, int B> struct S1 {
8 void foo() {
9 (void)(A == A); // expected-warning {{self-comparison always evaluates to true}}
10 (void)(A == B);
14 template <int A, int B> struct S2 {
15 template <typename T> T foo() {
16 (void)(A == A); // expected-warning {{self-comparison always evaluates to true}}
17 (void)(A == B);
21 struct S3 {
22 template <int A, int B> void foo() {
23 (void)(A == A); // expected-warning {{self-comparison always evaluates to true}}
24 (void)(A == B);
28 template <int A> struct S4 {
29 template <int B> void foo() {
30 (void)(A == A); // expected-warning {{self-comparison always evaluates to true}}
31 (void)(A == B);
35 const int N = 42;
36 template <int X> void foo2() {
37 (void)(X == N);
38 (void)(N == X);
41 void test() {
42 foo<1, 1>();
43 S1<1, 1> s1; s1.foo();
44 S2<1, 1> s2; s2.foo<void>();
45 S3 s3; s3.foo<1, 1>();
46 S4<1> s4; s4.foo<1>();
47 foo2<N>();