public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103852] New: Alias template argument deduction is available in C++17 mode
@ 2021-12-28 18:37 fchelnokov at gmail dot com
2021-12-28 21:37 ` [Bug c++/103852] [10/11/12 Regression] " pinskia at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: fchelnokov at gmail dot com @ 2021-12-28 18:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103852
Bug ID: 103852
Summary: Alias template argument deduction is available in
C++17 mode
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fchelnokov at gmail dot com
Target Milestone: ---
This is a valid C++20 code:
```
#include <set>
template<class Key, class Compare = std::less<Key>, class Allocator =
std::allocator<Key>>
using Set = std::set<Key, Compare, Allocator>;
int main() {
Set set2 = { 1, 2, 3 };
}
```
But in C++17 mode it shall be an error, since alias template argument deduction
is not available there. Still GCC wrongly accepts the code in C++17 mode. Demo:
https://gcc.godbolt.org/z/f5WbWdPqb
Related discussion: https://stackoverflow.com/q/68768937/7325599
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103852] [10/11/12 Regression] Alias template argument deduction is available in C++17 mode
2021-12-28 18:37 [Bug c++/103852] New: Alias template argument deduction is available in C++17 mode fchelnokov at gmail dot com
@ 2021-12-28 21:37 ` pinskia at gcc dot gnu.org
2022-01-04 18:55 ` ppalka at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-28 21:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103852
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Known to fail| |10.1.0
Known to work| |9.1.0
Last reconfirmed| |2021-12-28
Target Milestone|--- |10.4
Summary|Alias template argument |[10/11/12 Regression] Alias
|deduction is available in |template argument deduction
|C++17 mode |is available in C++17 mode
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed reduced testcase:
template <class T> struct b{};
template <class T, class T1 = b<T>>
struct s
{
s(T);
};
s c(100);
template <class T, class T1 = b<T>>
using ss = s<T, T1>;
ss tt(1);
---- CUT ----
tt defintion should fail in C++17 while pass in C++20.
It looks like when the support was added it was added unconditionally; could
there have been a Defect report?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103852] [10/11/12 Regression] Alias template argument deduction is available in C++17 mode
2021-12-28 18:37 [Bug c++/103852] New: Alias template argument deduction is available in C++17 mode fchelnokov at gmail dot com
2021-12-28 21:37 ` [Bug c++/103852] [10/11/12 Regression] " pinskia at gcc dot gnu.org
@ 2022-01-04 18:55 ` ppalka at gcc dot gnu.org
2022-01-18 13:57 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-04 18:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103852
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=92060
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
This happens because GCC implements the proposed resolution of CWG1286, which
makes simple alias templates such as Set equivalent to the underlying class
template. So the CTAD is not alias CTAD but ordinary CTAD.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103852] [10/11/12 Regression] Alias template argument deduction is available in C++17 mode
2021-12-28 18:37 [Bug c++/103852] New: Alias template argument deduction is available in C++17 mode fchelnokov at gmail dot com
2021-12-28 21:37 ` [Bug c++/103852] [10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-04 18:55 ` ppalka at gcc dot gnu.org
@ 2022-01-18 13:57 ` rguenth at gcc dot gnu.org
2022-04-01 19:49 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-18 13:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103852
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103852] [10/11/12 Regression] Alias template argument deduction is available in C++17 mode
2021-12-28 18:37 [Bug c++/103852] New: Alias template argument deduction is available in C++17 mode fchelnokov at gmail dot com
` (2 preceding siblings ...)
2022-01-18 13:57 ` rguenth at gcc dot gnu.org
@ 2022-04-01 19:49 ` jason at gcc dot gnu.org
2022-04-04 14:44 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-01 19:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103852
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Status|NEW |ASSIGNED
CC| |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103852] [10/11/12 Regression] Alias template argument deduction is available in C++17 mode
2021-12-28 18:37 [Bug c++/103852] New: Alias template argument deduction is available in C++17 mode fchelnokov at gmail dot com
` (3 preceding siblings ...)
2022-04-01 19:49 ` jason at gcc dot gnu.org
@ 2022-04-04 14:44 ` cvs-commit at gcc dot gnu.org
2022-04-04 14:57 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-04 14:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103852
--- Comment #3 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:a11f204e5a30d1dfd2508e3f3014509a0342f604
commit r12-7984-ga11f204e5a30d1dfd2508e3f3014509a0342f604
Author: Jason Merrill <jason@redhat.com>
Date: Fri Apr 1 15:55:21 2022 -0400
c++: alias-tmpl equivalence and default targs [PR103852]
The suggested resolution for CWG1286, which we implemented, ignores default
template arguments, but this PR is an example of why that doesn't make
sense: the templates aren't functionally equivalent.
PR c++/103852
DR 1286
gcc/cp/ChangeLog:
* pt.cc (get_underlying_template): Compare default template args.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alias-decl-dr1286a.C: Default args now matter.
* g++.dg/cpp1z/class-deduction-alias1.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103852] [10/11/12 Regression] Alias template argument deduction is available in C++17 mode
2021-12-28 18:37 [Bug c++/103852] New: Alias template argument deduction is available in C++17 mode fchelnokov at gmail dot com
` (4 preceding siblings ...)
2022-04-04 14:44 ` cvs-commit at gcc dot gnu.org
@ 2022-04-04 14:57 ` jason at gcc dot gnu.org
2022-04-05 16:30 ` cvs-commit at gcc dot gnu.org
2022-04-05 16:33 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-04 14:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103852
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |12.0
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
The patch doesn't affect the testcases, because there the templates are still
considered equivalent.
Though now I notice that the suggested resolution of DR1286 only considers
template equivalence in the context of comparing template arguments; it isn't
saying that they're interchangeable in all contexts. So perhaps we should stop
using that equivalence in this case.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103852] [10/11/12 Regression] Alias template argument deduction is available in C++17 mode
2021-12-28 18:37 [Bug c++/103852] New: Alias template argument deduction is available in C++17 mode fchelnokov at gmail dot com
` (5 preceding siblings ...)
2022-04-04 14:57 ` jason at gcc dot gnu.org
@ 2022-04-05 16:30 ` cvs-commit at gcc dot gnu.org
2022-04-05 16:33 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-05 16:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103852
--- Comment #5 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:5d583d24200ac33a1cb281b7ddee9aad351151b5
commit r12-7998-g5d583d24200ac33a1cb281b7ddee9aad351151b5
Author: Jason Merrill <jason@redhat.com>
Date: Mon Apr 4 11:56:38 2022 -0400
c++: alias template equivalence and CTAD [PR103852]
I had been thinking about DR1286 "equivalence" as meaning generally
interchangeable, but looking back at the proposed resolution in the context
of this PR, I see that it's just about use as a template argument. So
let's
give a pedwarn if we look through a renaming alias.
PR c++/103852
DR 1286
gcc/cp/ChangeLog:
* pt.cc (do_class_deduction): Pedwarn for renaming alias in C++17.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/class-deduction-alias1.C: Expect warning.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/103852] [10/11/12 Regression] Alias template argument deduction is available in C++17 mode
2021-12-28 18:37 [Bug c++/103852] New: Alias template argument deduction is available in C++17 mode fchelnokov at gmail dot com
` (6 preceding siblings ...)
2022-04-05 16:30 ` cvs-commit at gcc dot gnu.org
@ 2022-04-05 16:33 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-05 16:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103852
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
GCC 12 will give a pedwarn about the testcase. Not backporting.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-04-05 16:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28 18:37 [Bug c++/103852] New: Alias template argument deduction is available in C++17 mode fchelnokov at gmail dot com
2021-12-28 21:37 ` [Bug c++/103852] [10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-04 18:55 ` ppalka at gcc dot gnu.org
2022-01-18 13:57 ` rguenth at gcc dot gnu.org
2022-04-01 19:49 ` jason at gcc dot gnu.org
2022-04-04 14:44 ` cvs-commit at gcc dot gnu.org
2022-04-04 14:57 ` jason at gcc dot gnu.org
2022-04-05 16:30 ` cvs-commit at gcc dot gnu.org
2022-04-05 16:33 ` jason 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).