1 // PR c++/86524
2 // { dg-do run { target c++14 } }
3 // { dg-options "-O2" }
4 
5 extern "C" void abort ();
6 typedef __UINTPTR_TYPE__ uintptr_t;
7 
8 constexpr bool
foo(const int * x,const int * y)9 foo (const int *x, const int *y)
10 {
11   if (__builtin_constant_p (x < y))
12     return x < y;
13   return (uintptr_t) x < (uintptr_t) y;
14 }
15 
16 void
bar()17 bar ()
18 {
19   constexpr int x = 0;
20   static_assert (!(&x < &x));
21   static_assert (!foo (&x, &x));
22 }
23 
24 constexpr void
baz()25 baz ()
26 {
27   constexpr int x = 0;
28   static_assert (!(&x < &x));
29   static_assert (!foo (&x, &x));
30 }
31 
32 int i, j;
33 
34 int
main()35 main ()
36 {
37   bar ();
38   baz ();
39   if (!(foo (&i, &j) ^ foo (&j, &i)))
40     abort ();
41 }
42