public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96874] New: Internal Compiler Error: Segmentation fault on class NTTP
@ 2020-08-31 17:04 mateusz.pusz at gmail dot com
2020-08-31 22:09 ` [Bug c++/96874] " mpolacek at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: mateusz.pusz at gmail dot com @ 2020-08-31 17:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96874
Bug ID: 96874
Summary: Internal Compiler Error: Segmentation fault on class
NTTP
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];
}
[[nodiscard]] constexpr const CharT& operator[](std::size_t index) const
noexcept { return data_[index]; }
[[nodiscard]] constexpr CharT operator[](std::size_t index) noexcept { return
data_[index]; }
template<std::size_t N2>
[[nodiscard]] constexpr friend basic_fixed_string<CharT, N + N2> operator+(
const basic_fixed_string& lhs, const basic_fixed_string<CharT, N2>& rhs)
noexcept
{
CharT txt[N + N2 + 1] = {};
for(std::size_t i = 0; i != N; ++i) txt[i] = lhs[i];
for(std::size_t i = 0; i != N2; ++i) txt[N + i] = rhs[i];
return basic_fixed_string<CharT, N + N2>(txt);
}
};
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<basic_fixed_string>
struct X {};
template<basic_fixed_string Txt1, basic_fixed_string Txt2>
auto merge(X<Txt1>, X<Txt2>)
{
return X<Txt1 + Txt2>();
}
auto res = merge(X<"ab">(), X<"cd">());
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/96874] Internal Compiler Error: Segmentation fault on class NTTP
2020-08-31 17:04 [Bug c++/96874] New: Internal Compiler Error: Segmentation fault on class NTTP mateusz.pusz at gmail dot com
@ 2020-08-31 22:09 ` mpolacek at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-31 22:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96874
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |mpolacek at gcc dot gnu.org
Resolution|--- |DUPLICATE
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Looks like a dup.
*** This bug has been marked as a duplicate of bug 95291 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-31 22:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 17:04 [Bug c++/96874] New: Internal Compiler Error: Segmentation fault on class NTTP mateusz.pusz at gmail dot com
2020-08-31 22:09 ` [Bug c++/96874] " mpolacek at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).