public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106980] New: Concept on a variadig template
@ 2022-09-20 15:57 spiegelneuron at gmail dot com
2022-09-20 15:58 ` [Bug c++/106980] " redi at gcc dot gnu.org
2022-09-20 20:42 ` marxin at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: spiegelneuron at gmail dot com @ 2022-09-20 15:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106980
Bug ID: 106980
Summary: Concept on a variadig template
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: spiegelneuron at gmail dot com
Target Milestone: ---
The following code compiles fine with the current version of VC++ 2022:
#include <iostream>
#include <utility>
using namespace std;
template<size_t N, typename ... Fns>
#if defined(_MSC_VER)
requires (N >= 1) && (requires( Fns fn ) { { fn.template operator
()<(size_t)N - 1>() } -> std::same_as<void>; } && ...)
#elif defined(__GNUC__)
requires (N >= 1) && (requires( Fns ... fn ) { { fn.template operator
()<(size_t)N - 1>() } -> std::same_as<void>; } && ...)
#endif
void unroll( Fns ... fns )
{
auto unroll_n = [&]<typename Fn, size_t ... Indices>( Fn fn,
std::index_sequence<Indices ...> )
{
(fn.template operator ()<Indices>(), ...);
};
(unroll_n( fns, std::make_index_sequence<N>() ), ...);
}
int main()
{
unroll<3>(
[]<size_t I>() { cout << "hello " << I << endl; },
[]<size_t I>() { cout << "this " << I << endl; },
[]<size_t I>() { cout << "world " << I << endl; } );
}
g++ 11.2.0 crashes.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/106980] Concept on a variadig template
2022-09-20 15:57 [Bug c++/106980] New: Concept on a variadig template spiegelneuron at gmail dot com
@ 2022-09-20 15:58 ` redi at gcc dot gnu.org
2022-09-20 20:42 ` marxin at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-09-20 15:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106980
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Ever confirmed|0 |1
Last reconfirmed| |2022-09-20
Status|UNCONFIRMED |NEW
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/106980] Concept on a variadig template
2022-09-20 15:57 [Bug c++/106980] New: Concept on a variadig template spiegelneuron at gmail dot com
2022-09-20 15:58 ` [Bug c++/106980] " redi at gcc dot gnu.org
@ 2022-09-20 20:42 ` marxin at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-09-20 20:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106980
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Apparently clang also rejects the code:
$ clang++ pr106980.C -c -std=c++20
pr106980.C:10:27: error: requirement contains unexpanded parameter pack 'fn'
requires (N >= 1) && (requires( Fns ... fn ) { { fn.template operator
()<(size_t)N - 1>() } -> std::same_as<void>; } && ...)
^ ~~
1 error generated.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-20 20:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20 15:57 [Bug c++/106980] New: Concept on a variadig template spiegelneuron at gmail dot com
2022-09-20 15:58 ` [Bug c++/106980] " redi at gcc dot gnu.org
2022-09-20 20:42 ` marxin 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).