public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104326] New: Deduction failure for parameter pack in template template non-type parameter
@ 2022-02-01 16:21 colavitam at gmail dot com
2022-02-01 16:32 ` [Bug c++/104326] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: colavitam at gmail dot com @ 2022-02-01 16:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104326
Bug ID: 104326
Summary: Deduction failure for parameter pack in template
template non-type parameter
Product: gcc
Version: 11.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: colavitam at gmail dot com
Target Milestone: ---
Consider the following code:
```
template <typename... Args>
struct tuple {};
template <typename>
struct Test;
template <
typename... Types,
template <Types> typename... Outer,
Types... Inner
>
struct Test<tuple<Outer<Inner>...>> {};
template <long T> struct O1 {};
template <long T> struct O2 {};
template <unsigned T> struct O3 {};
Test<tuple<O1<1>, O2<2>>> test1;
Test<tuple<O1<1>, O2<2>, O3<3>>> test2;
```
This code is rejected by gcc and accepted by clang.
gcc accepts the definition of test1 but rejects test2. It appears as though
Types is not being correctly expanded with the template template parameter.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104326] Deduction failure for parameter pack in template template non-type parameter
2022-02-01 16:21 [Bug c++/104326] New: Deduction failure for parameter pack in template template non-type parameter colavitam at gmail dot com
@ 2022-02-01 16:32 ` pinskia at gcc dot gnu.org
2022-02-01 16:38 ` colavitam at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-01 16:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104326
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think there is a c++ standard defect report about this case. The problem is
the conversion of unsigned and long.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104326] Deduction failure for parameter pack in template template non-type parameter
2022-02-01 16:21 [Bug c++/104326] New: Deduction failure for parameter pack in template template non-type parameter colavitam at gmail dot com
2022-02-01 16:32 ` [Bug c++/104326] " pinskia at gcc dot gnu.org
@ 2022-02-01 16:38 ` colavitam at gmail dot com
2022-02-02 2:47 ` pinskia at gcc dot gnu.org
2022-02-02 4:05 ` colavitam at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: colavitam at gmail dot com @ 2022-02-01 16:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104326
--- Comment #2 from Michael Colavita <colavitam at gmail dot com> ---
It doesn't appear to be specific to the long and unsigned case. The problem
persists if you change unsigned to another type (or replace it with something
like a member pointer). I can't find an accepted case where the non-type
parameter type of O3 is different than the non-type parameter type of O2/O1.
e.g. the following still fails:
/* ... */
struct S {
long field;
};
template <long T> struct O1 {};
template <long T> struct O2 {};
template <long S::* T> struct O3 {};
Test<tuple<O1<1>, O2<3>>> test1;
Test<tuple<O1<1>, O2<3>, O3<&S::field>>> test2;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104326] Deduction failure for parameter pack in template template non-type parameter
2022-02-01 16:21 [Bug c++/104326] New: Deduction failure for parameter pack in template template non-type parameter colavitam at gmail dot com
2022-02-01 16:32 ` [Bug c++/104326] " pinskia at gcc dot gnu.org
2022-02-01 16:38 ` colavitam at gmail dot com
@ 2022-02-02 2:47 ` pinskia at gcc dot gnu.org
2022-02-02 4:05 ` colavitam at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-02 2:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104326
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, only clang is able to accept the code.
MSVC rejects it with:
<source>(13): error C3520: 'Types': parameter pack must be expanded in this
context
While ICC ICEs after an error message:
<source>(10): error: parameter pack "Types" was referenced but not expanded
template <Types> typename... Outer,
^
<source>(11): error: parameter pack "Types" was referenced but not expanded
Types... Inner
^
<source>(19): internal error: null pointer
Test<tuple<O1<1>, O2<2>>> test1;
^
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104326] Deduction failure for parameter pack in template template non-type parameter
2022-02-01 16:21 [Bug c++/104326] New: Deduction failure for parameter pack in template template non-type parameter colavitam at gmail dot com
` (2 preceding siblings ...)
2022-02-02 2:47 ` pinskia at gcc dot gnu.org
@ 2022-02-02 4:05 ` colavitam at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: colavitam at gmail dot com @ 2022-02-02 4:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104326
--- Comment #4 from Michael Colavita <colavitam at gmail dot com> ---
This is a slightly different case, but if you change
- template <Types> typename... Outer,
+ template <auto> typename... Outer,
it is accepted by both MSVC and clang (whereas gcc now rejects both test1 and
test2). ICC still ICEs.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-02 4:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 16:21 [Bug c++/104326] New: Deduction failure for parameter pack in template template non-type parameter colavitam at gmail dot com
2022-02-01 16:32 ` [Bug c++/104326] " pinskia at gcc dot gnu.org
2022-02-01 16:38 ` colavitam at gmail dot com
2022-02-02 2:47 ` pinskia at gcc dot gnu.org
2022-02-02 4:05 ` colavitam at gmail dot com
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).