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

            Bug ID: 88534
           Summary: internal compiler error: in
                    tree_add_const_value_attribute, at dwarf2out.c:20246
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hoganmeier at gmail dot com
  Target Milestone: ---

#include <cstdint>
#include <cstdlib>
#include <utility>

template <typename CharT, size_t N> class basic_fixed_string
{
        CharT content[N];
public: 
        using char_type = CharT;

        template <size_t... I> constexpr basic_fixed_string(const CharT
(&input)[N], std::index_sequence<I...>) noexcept: content{input[I]...} { }

        constexpr basic_fixed_string(const CharT (&input)[N]) noexcept:
basic_fixed_string(input, std::make_index_sequence<N>()) { }

        constexpr size_t size() const noexcept
    {
                // string literals are zero terminated
                if (content[N-1] == '\0')
            return N - 1;
                else return N;
        }
        constexpr CharT operator[](size_t i) const noexcept
    {
                return content[i];
        }
        constexpr const CharT * begin() const noexcept
    {
                return content;
        }
        constexpr const CharT * end() const noexcept
    {
                return content + size();
        }
};

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

template <basic_fixed_string S>
struct F
{
};

auto foo()
{
    F<"test"> f;
}


# g++ -O3 -std=c++2a -g -S
<source>:46:1: internal compiler error: in tree_add_const_value_attribute, at
dwarf2out.c:20246

Reply via email to