Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cpp2a/udlit-class-nttp-ctad.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
// PR c++/88095 // Test class non-type template parameters for literal operator templates. // Validate support for class template argument deduction. // { dg-do compile { target c++2a } } namespace std { using size_t = decltype(sizeof(int)); } template <typename CharT, std::size_t N> struct fixed_string { constexpr static std::size_t length = N; constexpr fixed_string(...) { } // auto operator<=> (const fixed_string&) = default; }; template <typename CharT, std::size_t N> fixed_string(const CharT (&str)[N]) -> fixed_string<CharT, N>; template <fixed_string fs> constexpr std::size_t operator"" _udl() { return decltype(fs)::length; } static_assert("test"_udl == 5);