public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks
@ 2020-08-31 16:58 mateusz.pusz at gmail dot com
2020-08-31 17:06 ` [Bug c++/96873] " mateusz.pusz at gmail dot com
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: mateusz.pusz at gmail dot com @ 2020-08-31 16:58 UTC (permalink / raw)
To: gcc-bugs
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;
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/96873] Internal compiler error in alias_ctad_tweaks
2020-08-31 16:58 [Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks mateusz.pusz at gmail dot com
@ 2020-08-31 17:06 ` mateusz.pusz at gmail dot com
2020-08-31 22:05 ` mpolacek at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mateusz.pusz at gmail dot com @ 2020-08-31 17:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96873
--- Comment #1 from Mateusz Pusz <mateusz.pusz at gmail dot com> ---
Similar error but in a different line happens for:
```
#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>;
fixed_string txt = "txt";
```
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/96873] Internal compiler error in alias_ctad_tweaks
2020-08-31 16:58 [Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks mateusz.pusz at gmail dot com
2020-08-31 17:06 ` [Bug c++/96873] " mateusz.pusz at gmail dot com
@ 2020-08-31 22:05 ` mpolacek at gcc dot gnu.org
2021-04-06 15:11 ` mateusz.pusz at gmail dot com
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-31 22:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96873
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
CC| |mpolacek at gcc dot gnu.org
Last reconfirmed| |2020-08-31
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=94691,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=94560,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=93085
Status|UNCONFIRMED |NEW
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed, but most likely a dup of one of the bugs in See Also. The
backtraces aren't identical, but I'm sure these are all related.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/96873] Internal compiler error in alias_ctad_tweaks
2020-08-31 16:58 [Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks mateusz.pusz at gmail dot com
2020-08-31 17:06 ` [Bug c++/96873] " mateusz.pusz at gmail dot com
2020-08-31 22:05 ` mpolacek at gcc dot gnu.org
@ 2021-04-06 15:11 ` mateusz.pusz at gmail dot com
2021-04-06 15:16 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mateusz.pusz at gmail dot com @ 2021-04-06 15:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96873
--- Comment #3 from Mateusz Pusz <mateusz.pusz at gmail dot com> ---
Are there any chances for it to be fixed for gcc-11 or gcc-10.3? This feature
is essential for the Physical Units library for C++Next.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/96873] Internal compiler error in alias_ctad_tweaks
2020-08-31 16:58 [Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks mateusz.pusz at gmail dot com
` (2 preceding siblings ...)
2021-04-06 15:11 ` mateusz.pusz at gmail dot com
@ 2021-04-06 15:16 ` mpolacek at gcc dot gnu.org
2021-04-06 15:16 ` mateusz.pusz at gmail dot com
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-06 15:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96873
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Yeah, hopefully for both.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/96873] Internal compiler error in alias_ctad_tweaks
2020-08-31 16:58 [Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks mateusz.pusz at gmail dot com
` (3 preceding siblings ...)
2021-04-06 15:16 ` mpolacek at gcc dot gnu.org
@ 2021-04-06 15:16 ` mateusz.pusz at gmail dot com
2021-04-06 19:08 ` johelegp at gmail dot com
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mateusz.pusz at gmail dot com @ 2021-04-06 15:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96873
--- Comment #5 from Mateusz Pusz <mateusz.pusz at gmail dot com> ---
Thanks!
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/96873] Internal compiler error in alias_ctad_tweaks
2020-08-31 16:58 [Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks mateusz.pusz at gmail dot com
` (4 preceding siblings ...)
2021-04-06 15:16 ` mateusz.pusz at gmail dot com
@ 2021-04-06 19:08 ` johelegp at gmail dot com
2021-04-10 4:07 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: johelegp at gmail dot com @ 2021-04-06 19:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96873
Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |johelegp at gmail dot com
--- Comment #6 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Could this be a duplicate of Bug 95486?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/96873] Internal compiler error in alias_ctad_tweaks
2020-08-31 16:58 [Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks mateusz.pusz at gmail dot com
` (5 preceding siblings ...)
2021-04-06 19:08 ` johelegp at gmail dot com
@ 2021-04-10 4:07 ` cvs-commit at gcc dot gnu.org
2021-04-10 4:14 ` jason at gcc dot gnu.org
2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-10 4:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96873
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:1a19d334ce493ec2ce2daeac74beef63fd67e2bc
commit r11-8104-g1a19d334ce493ec2ce2daeac74beef63fd67e2bc
Author: Jason Merrill <jason@redhat.com>
Date: Fri Apr 9 18:02:38 2021 -0400
c++: deduction guide using alias [PR99180]
alias_ctad_tweaks was expecting that all deduction guides for the class
would be suitable for deduction from the alias definition; in this case,
the
deduction guide uses 'true' and the alias B uses 'false', so deduction
fails. But that's OK, we just don't use that deduction guide. I also
noticed that we were giving up on deduction entirely if substitution failed
for some guide; we should only give up on that particular deduction guide.
We ought to give a better diagnostic about this case when deduction fails,
but that can wait.
gcc/cp/ChangeLog:
PR c++/99180
PR c++/93295
PR c++/93867
PR c++/99118
PR c++/96873
* pt.c (alias_ctad_tweaks): Handle failure better.
gcc/testsuite/ChangeLog:
PR c++/99180
PR c++/93295
PR c++/93867
PR c++/95486
* g++.dg/cpp2a/class-deduction-alias5.C: New test.
* g++.dg/cpp2a/class-deduction-alias6.C: New test.
* g++.dg/cpp2a/class-deduction-alias7.C: New test.
* g++.dg/cpp2a/class-deduction-alias8.C: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/96873] Internal compiler error in alias_ctad_tweaks
2020-08-31 16:58 [Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks mateusz.pusz at gmail dot com
` (6 preceding siblings ...)
2021-04-10 4:07 ` cvs-commit at gcc dot gnu.org
@ 2021-04-10 4:14 ` jason at gcc dot gnu.org
2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-10 4:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96873
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Dup.
*** This bug has been marked as a duplicate of bug 93295 ***
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/96873] Internal compiler error in alias_ctad_tweaks
2020-08-31 16:58 [Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks mateusz.pusz at gmail dot com
` (7 preceding siblings ...)
2021-04-10 4:14 ` jason at gcc dot gnu.org
@ 2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-20 21:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96873
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:92e9b2a995f718f1c2ab1cd0840b439c24d3535f
commit r10-9852-g92e9b2a995f718f1c2ab1cd0840b439c24d3535f
Author: Jason Merrill <jason@redhat.com>
Date: Fri Apr 9 18:02:38 2021 -0400
c++: deduction guide using alias [PR99180]
alias_ctad_tweaks was expecting that all deduction guides for the class
would be suitable for deduction from the alias definition; in this case,
the
deduction guide uses 'true' and the alias B uses 'false', so deduction
fails. But that's OK, we just don't use that deduction guide. I also
noticed that we were giving up on deduction entirely if substitution failed
for some guide; we should only give up on that particular deduction guide.
We ought to give a better diagnostic about this case when deduction fails,
but that can wait.
gcc/cp/ChangeLog:
PR c++/99180
PR c++/93295
PR c++/93867
PR c++/99118
PR c++/96873
* pt.c (alias_ctad_tweaks): Handle failure better.
gcc/testsuite/ChangeLog:
PR c++/99180
PR c++/93295
PR c++/93867
PR c++/95486
* g++.dg/cpp2a/class-deduction-alias5.C: New test.
* g++.dg/cpp2a/class-deduction-alias6.C: New test.
* g++.dg/cpp2a/class-deduction-alias7.C: New test.
* g++.dg/cpp2a/class-deduction-alias8.C: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-05-20 21:35 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 16:58 [Bug c++/96873] New: Internal compiler error in alias_ctad_tweaks mateusz.pusz at gmail dot com
2020-08-31 17:06 ` [Bug c++/96873] " mateusz.pusz at gmail dot com
2020-08-31 22:05 ` mpolacek at gcc dot gnu.org
2021-04-06 15:11 ` mateusz.pusz at gmail dot com
2021-04-06 15:16 ` mpolacek at gcc dot gnu.org
2021-04-06 15:16 ` mateusz.pusz at gmail dot com
2021-04-06 19:08 ` johelegp at gmail dot com
2021-04-10 4:07 ` cvs-commit at gcc dot gnu.org
2021-04-10 4:14 ` jason at gcc dot gnu.org
2021-05-20 21:35 ` cvs-commit 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).