public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/107111] New: GCC accepts invalid program involving function declaration with pack expansion @ 2022-10-01 17:05 jlame646 at gmail dot com 2022-10-01 17:11 ` [Bug c++/107111] " jlame646 at gmail dot com ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: jlame646 at gmail dot com @ 2022-10-01 17:05 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107111 Bug ID: 107111 Summary: GCC accepts invalid program involving function declaration with pack expansion Product: gcc Version: 12.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jlame646 at gmail dot com Target Milestone: --- The following program is incorrectly accepted by gcc. Demo: https://godbolt.org/z/rvfqzo5YW ``` template<typename T, typename... V> struct C { T v(V()...);; }; int main() { C<int> c; //works with gcc but rejected in clang C<int, double, int, int> c2; //same here: works with gcc but rejected in clang } ``` This is invalid because the construct `V()...` is actually equivalent to `V(),...`. So `V` is not expanded and this must be rejected. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/107111] GCC accepts invalid program involving function declaration with pack expansion 2022-10-01 17:05 [Bug c++/107111] New: GCC accepts invalid program involving function declaration with pack expansion jlame646 at gmail dot com @ 2022-10-01 17:11 ` jlame646 at gmail dot com 2022-10-01 17:24 ` jlame646 at gmail dot com ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: jlame646 at gmail dot com @ 2022-10-01 17:11 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107111 --- Comment #1 from Jason Liam <jlame646 at gmail dot com> --- The last statement in my original report is not valid because `V` is a template parameter pack. So ignore that line. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/107111] GCC accepts invalid program involving function declaration with pack expansion 2022-10-01 17:05 [Bug c++/107111] New: GCC accepts invalid program involving function declaration with pack expansion jlame646 at gmail dot com 2022-10-01 17:11 ` [Bug c++/107111] " jlame646 at gmail dot com @ 2022-10-01 17:24 ` jlame646 at gmail dot com 2022-10-02 4:34 ` iamsupermouse at mail dot ru ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: jlame646 at gmail dot com @ 2022-10-01 17:24 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107111 --- Comment #2 from Jason Liam <jlame646 at gmail dot com> --- Also gcc rejects `V...()` but clang accepts that. Demo: https://godbolt.org/z/bfx9rv6hP ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/107111] GCC accepts invalid program involving function declaration with pack expansion 2022-10-01 17:05 [Bug c++/107111] New: GCC accepts invalid program involving function declaration with pack expansion jlame646 at gmail dot com 2022-10-01 17:11 ` [Bug c++/107111] " jlame646 at gmail dot com 2022-10-01 17:24 ` jlame646 at gmail dot com @ 2022-10-02 4:34 ` iamsupermouse at mail dot ru 2022-10-02 4:35 ` iamsupermouse at mail dot ru 2022-10-02 9:47 ` jlame646 at gmail dot com 4 siblings, 0 replies; 6+ messages in thread From: iamsupermouse at mail dot ru @ 2022-10-02 4:34 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107111 Egor <iamsupermouse at mail dot ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |iamsupermouse at mail dot ru --- Comment #3 from Egor <iamsupermouse at mail dot ru> --- The correct behavior should be to accept `V...()` and to reject `V()...`. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/107111] GCC accepts invalid program involving function declaration with pack expansion 2022-10-01 17:05 [Bug c++/107111] New: GCC accepts invalid program involving function declaration with pack expansion jlame646 at gmail dot com ` (2 preceding siblings ...) 2022-10-02 4:34 ` iamsupermouse at mail dot ru @ 2022-10-02 4:35 ` iamsupermouse at mail dot ru 2022-10-02 9:47 ` jlame646 at gmail dot com 4 siblings, 0 replies; 6+ messages in thread From: iamsupermouse at mail dot ru @ 2022-10-02 4:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107111 --- Comment #4 from Egor <iamsupermouse at mail dot ru> --- *** Bug 107113 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/107111] GCC accepts invalid program involving function declaration with pack expansion 2022-10-01 17:05 [Bug c++/107111] New: GCC accepts invalid program involving function declaration with pack expansion jlame646 at gmail dot com ` (3 preceding siblings ...) 2022-10-02 4:35 ` iamsupermouse at mail dot ru @ 2022-10-02 9:47 ` jlame646 at gmail dot com 4 siblings, 0 replies; 6+ messages in thread From: jlame646 at gmail dot com @ 2022-10-02 9:47 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107111 --- Comment #5 from Jason Liam <jlame646 at gmail dot com> --- Note also that gcc accepts `T v(V...b())` but rejects `T v(V...())`. Note the use of parameter name in the former. Demo: https://godbolt.org/z/hMevdc8TE ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-02 9:47 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-10-01 17:05 [Bug c++/107111] New: GCC accepts invalid program involving function declaration with pack expansion jlame646 at gmail dot com 2022-10-01 17:11 ` [Bug c++/107111] " jlame646 at gmail dot com 2022-10-01 17:24 ` jlame646 at gmail dot com 2022-10-02 4:34 ` iamsupermouse at mail dot ru 2022-10-02 4:35 ` iamsupermouse at mail dot ru 2022-10-02 9:47 ` jlame646 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).