aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/constexpr-if22.C
blob: 76f0c73476b3172a45a2fd2e025c5dfad9e0da89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// PR c++/85695
// { dg-options -std=c++17 }

template <typename T, T v>
struct integral_constant {
    using value_type = T;
    static constexpr const value_type value = v;
    constexpr operator value_type (void) const { return value; }
};
template <typename T> struct is_trivial
    : public integral_constant<bool, __is_trivial(T)> {};

template <typename T>
T clone_object (const T& p)
{
    if constexpr (is_trivial<T>::value)
        return p;
    else
        return p.clone();
}
int main (void) { return clone_object(0); }