public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102470] New: C++20 NTTP causes ICE
@ 2021-09-23 12:59 iDingDong at outlook dot com
2021-09-23 13:05 ` [Bug c++/102470] " iDingDong at outlook dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: iDingDong at outlook dot com @ 2021-09-23 12:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102470
Bug ID: 102470
Summary: C++20 NTTP causes ICE
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: iDingDong at outlook dot com
Target Milestone: ---
GCC 11.2 reports ICE to the following piece of code:
//---
#include <concepts>
template <typename T> struct A {
A(A<T> const&) = default;
};
template <std::same_as<int> T> struct A<T> {
A(A<T> const&) = default;
};
//---
Compiled with:
> gcc -std=c++20 test.cpp
The error message:
> gcc -std=c++20 test.cpp
> test.cpp: In substitution of 'template<MemAttr attr> using AlignedStorage = std::aligned_storage_t<((const MemAttr)attr).size, ((const MemAttr)attr).align> [with MemAttr attr = memAttrOf<T>]':
> test.cpp:13:75: required from here
> test.cpp:11:73: internal compiler error: Segmentation fault
> 11 | template <MemAttr attr> using AlignedStorage = ::std::aligned_storage_t<attr.size, attr.align>;
> | ^~~~
> libbacktrace could not find executable to open
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <https://gcc.gnu.org/bugs/> for instructions.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/102470] C++20 NTTP causes ICE
2021-09-23 12:59 [Bug c++/102470] New: C++20 NTTP causes ICE iDingDong at outlook dot com
@ 2021-09-23 13:05 ` iDingDong at outlook dot com
2023-11-16 0:58 ` arthur.j.odwyer at gmail dot com
2023-11-16 15:38 ` ppalka at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: iDingDong at outlook dot com @ 2021-09-23 13:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102470
--- Comment #1 from Kun Ge <iDingDong at outlook dot com> ---
I misplaced the wrong piece of codes.
the code that actually triggered the error is:
//---
#include <cstdlib>
#include <memory>
struct MemAttr {
std::size_t size;
std::size_t align;
};
template <typename T> constexpr MemAttr memAttrOf = MemAttr { .size =
sizeof(T), .align = alignof(T) };
template <MemAttr attr> using AlignedStorage =
::std::aligned_storage_t<attr.size, attr.align>;
template <typename T> using AlignedStorageFor = AlignedStorage<memAttrOf<T>>;
//---
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/102470] C++20 NTTP causes ICE
2021-09-23 12:59 [Bug c++/102470] New: C++20 NTTP causes ICE iDingDong at outlook dot com
2021-09-23 13:05 ` [Bug c++/102470] " iDingDong at outlook dot com
@ 2023-11-16 0:58 ` arthur.j.odwyer at gmail dot com
2023-11-16 15:38 ` ppalka at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2023-11-16 0:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102470
Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |arthur.j.odwyer at gmail dot com
--- Comment #2 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> ---
Segfaults starting in GCC 9.1 (the first release with class NTTPs) until 12.3,
succeeds fine in GCC 13.1 and later.
Reduced: https://compiler-explorer.com/z/Kea5ar6MM
struct MA { int x; };
template<class> constexpr int mao = 1;
template<int> struct AST {};
template<MA ma> using AS = AST<ma.x>;
template<class> using ASF = AS<mao<int>>;
<source>: In substitution of 'template<MA ma> using AS = AST<((const MA)ma).x>
[with MA ma = mao<int>]':
<source>:5:39: required from here
<source>:4:32: internal compiler error: Segmentation fault
4 | template<MA ma> using AS = AST<ma.x>;
| ^~
0x1bbabfe internal_error(char const*, ...)
0x109f844 strip_array_types(tree_node*)
0x8d3f2c cp_type_quals(tree_node const*)
0x88e40f tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
0x87b764 tsubst(tree_node*, tree_node*, int, tree_node*)
[...]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/102470] C++20 NTTP causes ICE
2021-09-23 12:59 [Bug c++/102470] New: C++20 NTTP causes ICE iDingDong at outlook dot com
2021-09-23 13:05 ` [Bug c++/102470] " iDingDong at outlook dot com
2023-11-16 0:58 ` arthur.j.odwyer at gmail dot com
@ 2023-11-16 15:38 ` ppalka at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-11-16 15:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102470
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
CC| |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed by r13-4807, so let's call this a dup of PR103346
*** This bug has been marked as a duplicate of bug 103346 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-16 15:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 12:59 [Bug c++/102470] New: C++20 NTTP causes ICE iDingDong at outlook dot com
2021-09-23 13:05 ` [Bug c++/102470] " iDingDong at outlook dot com
2023-11-16 0:58 ` arthur.j.odwyer at gmail dot com
2023-11-16 15:38 ` ppalka 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).