public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95015] New: Partial specializations of class templates with class NTTP fails
@ 2020-05-08 18:48 mateusz.pusz at gmail dot com
2021-03-12 3:05 ` [Bug c++/95015] " johelegp at gmail dot com
2021-04-22 19:41 ` ppalka at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: mateusz.pusz at gmail dot com @ 2020-05-08 18:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95015
Bug ID: 95015
Summary: Partial specializations of class templates with class
NTTP fails
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: ---
The following code does not compile:
```
template<typename T>
struct X {
T a;
int b;
};
template<typename T>
X(T, int) -> X<T>; // <- does not work
// X(T) -> X<T>; // < works
template<X V>
struct Y {};
template<typename T>
inline constexpr bool is_Y = false;
template<X NTTP>
inline constexpr bool is_Y<Y<NTTP>> = true;
X x(3, 3);
Y<X(3, 3)> y;
using my_y = Y<X(3, 3)>;
static_assert(is_Y<my_y>);
```
The error is:
```
<source>:16:30: error: class template argument deduction failed:
16 | inline constexpr bool is_Y<Y<NTTP>> = true;
| ^~~~
<source>:16:30: error: no matching function for call to 'X(X<...auto...>)'
<source>:2:8: note: candidate: 'template<class T> X()-> X<T>'
2 | struct X {
| ^
<source>:2:8: note: template argument deduction/substitution failed:
<source>:16:30: note: candidate expects 0 arguments, 1 provided
16 | inline constexpr bool is_Y<Y<NTTP>> = true;
| ^~~~
<source>:2:8: note: candidate: 'template<class T> X(X<T>)-> X<T>'
2 | struct X {
| ^
<source>:2:8: note: template argument deduction/substitution failed:
<source>:16:30: note: mismatched types 'X<T>' and 'X<...auto...>'
16 | inline constexpr bool is_Y<Y<NTTP>> = true;
| ^~~~
<source>:7:1: note: candidate: 'template<class T> X(T, int)-> X<T>'
7 | X(T, int) -> X<T>; // <- does not work
| ^
<source>:7:1: note: template argument deduction/substitution failed:
<source>:16:30: note: candidate expects 2 arguments, 1 provided
16 | inline constexpr bool is_Y<Y<NTTP>> = true;
| ^~~~
<source>:16:23: error: template argument 1 is invalid
16 | inline constexpr bool is_Y<Y<NTTP>> = true;
| ^~~~~~~~~~~~~
<source>:16:23: error: template-id 'is_Y<<expression error> >' for 'is_Y' does
not match any template declaration
<source>:14:23: note: candidate is: 'template<class T> constexpr const bool
is_Y<T>'
14 | inline constexpr bool is_Y = false;
| ^~~~
<source>:21:15: error: static assertion failed
21 | static_assert(is_Y<my_y>);
| ^~~~~~~~~~
Compiler returned: 1
```
https://godbolt.org/z/597fXY
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/95015] Partial specializations of class templates with class NTTP fails
2020-05-08 18:48 [Bug c++/95015] New: Partial specializations of class templates with class NTTP fails mateusz.pusz at gmail dot com
@ 2021-03-12 3:05 ` johelegp at gmail dot com
2021-04-22 19:41 ` ppalka at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: johelegp at gmail dot com @ 2021-03-12 3:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95015
Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |johelegp at gmail dot com
--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Seems fixed in trunk, with and without the deduction guide.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/95015] Partial specializations of class templates with class NTTP fails
2020-05-08 18:48 [Bug c++/95015] New: Partial specializations of class templates with class NTTP fails mateusz.pusz at gmail dot com
2021-03-12 3:05 ` [Bug c++/95015] " johelegp at gmail dot com
@ 2021-04-22 19:41 ` ppalka at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-22 19:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95015
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |ppalka at gcc dot gnu.org
Resolution|--- |DUPLICATE
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Johel Ernesto Guerrero Peña from comment #1)
> Seems fixed in trunk, with and without the deduction guide.
Ever since r11-5752, so dup of PR93083 apparently.
*** This bug has been marked as a duplicate of bug 93083 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-22 19:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 18:48 [Bug c++/95015] New: Partial specializations of class templates with class NTTP fails mateusz.pusz at gmail dot com
2021-03-12 3:05 ` [Bug c++/95015] " johelegp at gmail dot com
2021-04-22 19:41 ` 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).