1 // RUN: %clang_cc1 -std=c++20 -include %s %s -o %t
3 // RUN: %clang_cc1 -std=c++20 -emit-pch %s -o %t
4 // RUN: %clang_cc1 -std=c++20 -include-pch %t -verify %s
6 // expected-no-diagnostics
12 struct A
{ union { int n
, m
; }; int *p
; int A::*q
; char buffer
[32]; };
14 template<A a
> constexpr const A
&get
= a
;
16 constexpr const A
&v
= get
<A
{}>;
17 constexpr const A
&w
= get
<A
{1, &g
, &A::n
, "hello"}>;
19 #else /*included pch*/
21 template<A a
> constexpr const A
&get2
= a
;
23 constexpr const A
&v2
= get2
<A
{}>;
24 constexpr const A
&w2
= get2
<A
{1, &g
, &A::n
, "hello\0\0\0\0\0"}>;
26 static_assert(&v
== &v2
);
27 static_assert(&w
== &w2
);
29 static_assert(&v
!= &w
);
30 static_assert(&v2
!= &w
);
31 static_assert(&v
!= &w2
);
32 static_assert(&v2
!= &w2
);
34 constexpr const A
&v3
= get2
<A
{.n
= 0}>;
35 constexpr const A
&x
= get2
<A
{.m
= 0}>;
37 static_assert(&v
== &v3
);
38 static_assert(&v
!= &x
);