aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/constexpr-ref2.C
blob: 659beed3a255f99c5a1138a6095567b7bb2c4d90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// PR c++/123738
// { dg-do compile { target c++20 } }

struct OStringLiteral {
    int str = 0;
};

template<auto L> struct OStringHolder {
    static constexpr auto & literal = L;
};

struct OString {
    template<auto L> constexpr OString(OStringHolder<L> const &):
        p(&OStringHolder<L>::literal.str) {}
    int const * p;
};


constexpr OString s = OStringHolder<OStringLiteral{}>{};