public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter
@ 2021-11-20 18:54 johelegp at gmail dot com
2021-11-22 9:15 ` [Bug c++/103341] " rguenth at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: johelegp at gmail dot com @ 2021-11-20 18:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
Bug ID: 103341
Summary: ICE type of variable instantiation constrained on
template parameter
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: johelegp at gmail dot com
CC: johelegp at gmail dot com
Target Milestone: ---
See https://godbolt.org/z/68GYeKqK4.
```C++
template<class, class> struct is_same { };
template<class T, class U> concept same_as = is_same<T, U>::value;
template<class T> inline constexpr same_as<T> auto trait_v{1};
using _ [[maybe_unused]] = decltype(trait_v<int>);
```
Output:
```
<source>: In instantiation of 'constexpr const auto [requires
::same_as<<placeholder>, T>] trait_v<int>':
<source>:4:37: required from here
<source>:3:52: internal compiler error: tree check: accessed elt 1 of
'tree_vec' with 0 elts in hash, at cp/constraint.cc:2503
3 | template<class T> inline constexpr same_as<T> auto trait_v{1};
| ^~~~~~~
0x206d4e9 internal_error(char const*, ...)
???:0
0x6da40c tree_vec_elt_check_failed(int, int, char const*, int, char const*)
???:0
0x85fca0 sat_hasher::hash(sat_entry*)
???:0
0x85aed7 satisfaction_cache::satisfaction_cache(tree_node*, tree_node*,
sat_info)
???:0
0x85f01a constraints_satisfied_p(tree_node*, tree_node*)
???:0
0xa3384b do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
???:0
0x8d2c1d cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
???:0
0xa46987 instantiate_decl(tree_node*, bool, bool)
???:0
0x8e7c9e maybe_instantiate_decl(tree_node*)
???:0
0x8e9760 mark_used(tree_node*, int)
???:0
0xabe557 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*,
bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int)
???:0
0xa0cc65 c_parse_file()
???:0
0xb94bf2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/103341] ICE type of variable instantiation constrained on template parameter
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
@ 2021-11-22 9:15 ` rguenth at gcc dot gnu.org
2021-12-14 8:08 ` [Bug c++/103341] [10/11 Regression] " pinskia at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-22 9:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-11-22
Status|UNCONFIRMED |NEW
Keywords| |ice-on-valid-code
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. clang++ seems to accept it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/103341] [10/11 Regression] ICE type of variable instantiation constrained on template parameter
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
2021-11-22 9:15 ` [Bug c++/103341] " rguenth at gcc dot gnu.org
@ 2021-12-14 8:08 ` pinskia at gcc dot gnu.org
2021-12-14 8:09 ` [Bug c++/103341] [11/12 " pinskia at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-14 8:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ICE type of variable |[10/11 Regression] ICE type
|instantiation constrained |of variable instantiation
|on template parameter |constrained on template
| |parameter
Known to fail| |11.1.0
Target Milestone|--- |11.3
Known to work| |10.3.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/103341] [11/12 Regression] ICE type of variable instantiation constrained on template parameter
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
2021-11-22 9:15 ` [Bug c++/103341] " rguenth at gcc dot gnu.org
2021-12-14 8:08 ` [Bug c++/103341] [10/11 Regression] " pinskia at gcc dot gnu.org
@ 2021-12-14 8:09 ` pinskia at gcc dot gnu.org
2021-12-14 8:13 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-14 8:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |asolokha at gmx dot com
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 103706 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/103341] [11/12 Regression] ICE type of variable instantiation constrained on template parameter
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
` (2 preceding siblings ...)
2021-12-14 8:09 ` [Bug c++/103341] [11/12 " pinskia at gcc dot gnu.org
@ 2021-12-14 8:13 ` pinskia at gcc dot gnu.org
2022-01-17 12:55 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-14 8:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced with an extra testcase from PR 103706:
template<class T, class U> concept C = sizeof(T) == sizeof(int);
template<class T> inline constexpr C<T> auto trait_v{1};
decltype(trait_v<int>) t = 1;
template<typename T> void g5() {
[]() -> C<T> auto{ return T(); }();
}
template void g5<int>();
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/103341] [11/12 Regression] ICE type of variable instantiation constrained on template parameter
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
` (3 preceding siblings ...)
2021-12-14 8:13 ` pinskia at gcc dot gnu.org
@ 2022-01-17 12:55 ` rguenth at gcc dot gnu.org
2022-01-28 13:18 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-17 12:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/103341] [11/12 Regression] ICE type of variable instantiation constrained on template parameter
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
` (4 preceding siblings ...)
2022-01-17 12:55 ` rguenth at gcc dot gnu.org
@ 2022-01-28 13:18 ` cvs-commit at gcc dot gnu.org
2022-01-28 13:30 ` [Bug c++/103341] [11 " ppalka at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-28 13:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:e272cf95ba048fde60b21aee046c9ca9c9264425
commit r12-6919-ge272cf95ba048fde60b21aee046c9ca9c9264425
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Jan 28 08:18:28 2022 -0500
c++: var tmpl w/ dependent constrained auto type [PR103341]
When deducing the type of a variable template (or templated static data
member) with a constrained auto type, we might need its template
arguments for satisfaction since the constraint could depend on them.
PR c++/103341
gcc/cp/ChangeLog:
* decl.cc (cp_finish_decl): Pass the template arguments of a
variable template specialization or a templated static data
member to do_auto_deduction when the auto is constrained.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-class4.C: New test.
* g++.dg/cpp2a/concepts-var-templ2.C: New test.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/103341] [11 Regression] ICE type of variable instantiation constrained on template parameter
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
` (5 preceding siblings ...)
2022-01-28 13:18 ` cvs-commit at gcc dot gnu.org
@ 2022-01-28 13:30 ` ppalka at gcc dot gnu.org
2022-01-31 6:16 ` asolokha at gmx dot com
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-28 13:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
Summary|[11/12 Regression] ICE type |[11 Regression] ICE type of
|of variable instantiation |variable instantiation
|constrained on template |constrained on template
|parameter |parameter
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for 12 so far.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/103341] [11 Regression] ICE type of variable instantiation constrained on template parameter
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
` (6 preceding siblings ...)
2022-01-28 13:30 ` [Bug c++/103341] [11 " ppalka at gcc dot gnu.org
@ 2022-01-31 6:16 ` asolokha at gmx dot com
2022-01-31 16:28 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: asolokha at gmx dot com @ 2022-01-31 6:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
--- Comment #6 from Arseny Solokha <asolokha at gmx dot com> ---
g++ 12.0.1 20220130 snapshot (g:baf98320ac6cd56da0c0b460fb94e3b87a79220d) still
ICEs on the testcase in comment 3.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/103341] [11 Regression] ICE type of variable instantiation constrained on template parameter
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
` (7 preceding siblings ...)
2022-01-31 6:16 ` asolokha at gmx dot com
@ 2022-01-31 16:28 ` ppalka at gcc dot gnu.org
2022-04-12 23:44 ` cvs-commit at gcc dot gnu.org
2022-04-12 23:47 ` ppalka at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-31 16:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Arseny Solokha from comment #6)
> g++ 12.0.1 20220130 snapshot (g:baf98320ac6cd56da0c0b460fb94e3b87a79220d)
> still ICEs on the testcase in comment 3.
Looks like that one requires a different fix, so I just reopened PR103706.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/103341] [11 Regression] ICE type of variable instantiation constrained on template parameter
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
` (8 preceding siblings ...)
2022-01-31 16:28 ` ppalka at gcc dot gnu.org
@ 2022-04-12 23:44 ` cvs-commit at gcc dot gnu.org
2022-04-12 23:47 ` ppalka at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-12 23:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:12b11107edfcde6a16ec397a9120687a14254215
commit r11-9841-g12b11107edfcde6a16ec397a9120687a14254215
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Jan 28 08:18:28 2022 -0500
c++: var tmpl w/ dependent constrained auto type [PR103341]
When deducing the type of a variable template (or templated static data
member) with a constrained auto type, we might need its template
arguments for satisfaction since the constraint could depend on them.
PR c++/103341
gcc/cp/ChangeLog:
* decl.c (cp_finish_decl): Pass the template arguments of a
variable template specialization or a templated static data
member to do_auto_deduction when the auto is constrained.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-class4.C: New test.
* g++.dg/cpp2a/concepts-var-templ2.C: New test.
(cherry picked from commit e272cf95ba048fde60b21aee046c9ca9c9264425)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/103341] [11 Regression] ICE type of variable instantiation constrained on template parameter
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
` (9 preceding siblings ...)
2022-04-12 23:44 ` cvs-commit at gcc dot gnu.org
@ 2022-04-12 23:47 ` ppalka at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-04-12 23:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103341
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.3/12.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-04-12 23:47 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-20 18:54 [Bug c++/103341] New: ICE type of variable instantiation constrained on template parameter johelegp at gmail dot com
2021-11-22 9:15 ` [Bug c++/103341] " rguenth at gcc dot gnu.org
2021-12-14 8:08 ` [Bug c++/103341] [10/11 Regression] " pinskia at gcc dot gnu.org
2021-12-14 8:09 ` [Bug c++/103341] [11/12 " pinskia at gcc dot gnu.org
2021-12-14 8:13 ` pinskia at gcc dot gnu.org
2022-01-17 12:55 ` rguenth at gcc dot gnu.org
2022-01-28 13:18 ` cvs-commit at gcc dot gnu.org
2022-01-28 13:30 ` [Bug c++/103341] [11 " ppalka at gcc dot gnu.org
2022-01-31 6:16 ` asolokha at gmx dot com
2022-01-31 16:28 ` ppalka at gcc dot gnu.org
2022-04-12 23:44 ` cvs-commit at gcc dot gnu.org
2022-04-12 23:47 ` 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).