[Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks

mateusz.pusz at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Aug 31 16:58:44 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96873

            Bug ID: 96873
           Summary: Internal compiler error in alias_ctad_tweaks
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mateusz.pusz at gmail dot com
  Target Milestone: ---

#include <cstdint>

template<typename CharT, std::size_t N>
struct basic_fixed_string {
  CharT data_[N + 1] = {};

  constexpr basic_fixed_string(CharT ch) noexcept { data_[0] = ch; }

  constexpr basic_fixed_string(const CharT (&txt)[N + 1]) noexcept
  {
    if constexpr (N != 0)
      for (std::size_t i = 0; i < N; ++i) data_[i] = txt[i];
  }
};

template<typename CharT, std::size_t N>
basic_fixed_string(const CharT (&str)[N]) -> basic_fixed_string<CharT, N - 1>;

template<typename CharT>
basic_fixed_string(CharT) -> basic_fixed_string<CharT, 1>;

template<std::size_t N>
using fixed_string = basic_fixed_string<char, N>;

template<fixed_string>
struct X {};

X<"txt"> x;


More information about the Gcc-bugs mailing list