Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp2a/nontype-class1.C @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 1830386684a0 |
children |
line wrap: on
line source
// { dg-do compile { target c++2a } } // { dg-additional-options "-fdelete-null-pointer-checks" } struct A { int i; constexpr A (int i): i(i) {} // auto operator<=> (const A&) = default; }; template <A a> struct B { static constexpr int i = a.i; static constexpr A const* ap = &a; }; template <A a> struct C { static constexpr A const* ap = &a; }; static_assert(B<1>::i == 1); static_assert(B<2>::i == 2); static_assert(B<1>::ap == C<1>::ap); static_assert(B<1>::ap != C<2>::ap); // { dg-final { scan-assembler "_Z1fP1BIXtl1ALi1EEEE" } } // { dg-final { scan-assembler "_ZTAXtl1ALi1EEE" } } const void* f(B<1> *p) { constexpr int i = p->ap->i; return p->ap; }