1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection \
2 // RUN: -analyzer-config eagerly-assume=false -std=c++20 -verify %s
4 template <class T
> void clang_analyzer_dump(T
);
5 void clang_analyzer_eval(bool);
10 bool operator ==(Box lhs
, Box rhs
) {
11 return lhs
.value
== rhs
.value
;
13 template <Box V
> void dumps() {
14 clang_analyzer_dump(V
); // expected-warning {{lazyCompoundVal}}
15 clang_analyzer_dump(&V
); // expected-warning {{Unknown}}
16 clang_analyzer_dump(V
.value
); // expected-warning {{Unknown}} FIXME: It should be '6 S32b'.
17 clang_analyzer_dump(&V
.value
); // expected-warning {{Unknown}}
19 template void dumps
<Box
{6}>();
21 // [temp.param].7.3.2:
22 // "All such template parameters in the program of the same type with the
23 // same value denote the same template parameter object."
24 template <Box A1
, Box A2
, Box B1
, Box B2
> void stable_addresses() {
25 clang_analyzer_eval(&A1
== &A2
); // expected-warning {{UNKNOWN}} FIXME: It should be TRUE.
26 clang_analyzer_eval(&B1
== &B2
); // expected-warning {{UNKNOWN}} FIXME: It should be TRUE.
27 clang_analyzer_eval(&A1
== &B2
); // expected-warning {{UNKNOWN}} FIXME: It should be FALSE.
29 clang_analyzer_eval(A1
== A2
); // expected-warning {{UNKNOWN}} FIXME: It should be TRUE.
30 clang_analyzer_eval(B1
== B2
); // expected-warning {{UNKNOWN}} FIXME: It should be TRUE.
31 clang_analyzer_eval(A1
== B2
); // expected-warning {{UNKNOWN}} FIXME: It should be FALSE.
33 template void stable_addresses
<Box
{1}, Box
{1}, Box
{2}, Box
{2}>();