public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected
@ 2022-03-26 10:46 wjwray at gmail dot com
2022-03-26 11:00 ` [Bug c++/105061] " wjwray at gmail dot com
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: wjwray at gmail dot com @ 2022-03-26 10:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105061
Bug ID: 105061
Summary: [9/10 Regression] [c++2a+] anonymous bitfield
templated offset rejected
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: wjwray at gmail dot com
Target Milestone: ---
A very specific regression: https://godbolt.org/z/dWxnvd93j
template <typename alloc_unit, int width, int offset>
struct offset_bitfield { alloc_unit : offset, field : width; };
accepted forever with -std=c++17-
accepted in 9.4 with -std=c++2a
rejected in 10.1+ with -std=c++20+
(accepted in Clang & MSVC, any std)
My guess as to the cause: the c++20 change to allow bitfield initializers.
template <typename alloc_unit, int width, int offset>
struct offset_bitfield { alloc_unit : offset, field : width; };
// ^ ^
// error: found ':' in nested-name-specifier, expected '::'
// error: expected unqualified-id before ',' token
The template is accepted if the typename parameter is removed:
template <int width, int offset>
struct uint_offset_bitfield { unsigned : offset, field : width; };
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/105061] [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected
2022-03-26 10:46 [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected wjwray at gmail dot com
@ 2022-03-26 11:00 ` wjwray at gmail dot com
2022-03-28 7:19 ` [Bug c++/105061] [10/11/12 " rguenth at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: wjwray at gmail dot com @ 2022-03-26 11:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105061
--- Comment #1 from Will Wray <wjwray at gmail dot com> ---
Hmm, the accepted simplified version ^^^ with typename parameter removed
is then rejected if 'unsigned' is replaced with 'uint32_t' from <cstdint>
#include <cstdint>
template <int width, int offset>
struct uint_offset_bitfield { uint32_t : offset, field : width; };
| ^
| error: found ':' in nested-name-specifier, expected '::'
| ::
| error: invalid use of '::'
(and "error: invalid use of '::'" is just wrong - no use of '::' at all)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/105061] [10/11/12 Regression] [c++2a+] anonymous bitfield templated offset rejected
2022-03-26 10:46 [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected wjwray at gmail dot com
2022-03-26 11:00 ` [Bug c++/105061] " wjwray at gmail dot com
@ 2022-03-28 7:19 ` rguenth at gcc dot gnu.org
2022-03-28 9:51 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-28 7:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105061
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.3.1
Keywords| |needs-bisection
Target Milestone|--- |10.4
Summary|[9/10 Regression] [c++2a+] |[10/11/12 Regression]
|anonymous bitfield |[c++2a+] anonymous bitfield
|templated offset rejected |templated offset rejected
Known to work| |9.4.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/105061] [10/11/12 Regression] [c++2a+] anonymous bitfield templated offset rejected
2022-03-26 10:46 [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected wjwray at gmail dot com
2022-03-26 11:00 ` [Bug c++/105061] " wjwray at gmail dot com
2022-03-28 7:19 ` [Bug c++/105061] [10/11/12 " rguenth at gcc dot gnu.org
@ 2022-03-28 9:51 ` jakub at gcc dot gnu.org
2022-03-28 10:07 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-28 9:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105061
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
Keywords|needs-bisection |
Priority|P3 |P2
Last reconfirmed| |2022-03-28
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r10-3735-gcb57504a550158913258e5be8ddb991376475efb
P0683R1 was done already r8-3526-g603be0224edf653c1e38229e1d32ed449ffd23bd
template <typename T, int U, int V>
struct A { T : V, u : U; };
template <int U, int V>
struct B { unsigned : V, u : U; };
typedef unsigned uns;
template <int U, int V>
struct C { uns : V, u : U; };
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/105061] [10/11/12 Regression] [c++2a+] anonymous bitfield templated offset rejected
2022-03-26 10:46 [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected wjwray at gmail dot com
` (2 preceding siblings ...)
2022-03-28 9:51 ` jakub at gcc dot gnu.org
@ 2022-03-28 10:07 ` jakub at gcc dot gnu.org
2022-03-28 15:37 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-28 10:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105061
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Just a wild guess, should cp_parser_template_introduction temporarily clear
parser->colon_corrects_to_scope_p (perhaps only if member_p)?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/105061] [10/11/12 Regression] [c++2a+] anonymous bitfield templated offset rejected
2022-03-26 10:46 [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected wjwray at gmail dot com
` (3 preceding siblings ...)
2022-03-28 10:07 ` jakub at gcc dot gnu.org
@ 2022-03-28 15:37 ` jakub at gcc dot gnu.org
2022-03-30 7:17 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-28 15:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105061
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 52701
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52701&action=edit
gcc12-pr105061.patch
After reading what template-introduction is I think that is the right fix.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/105061] [10/11/12 Regression] [c++2a+] anonymous bitfield templated offset rejected
2022-03-26 10:46 [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected wjwray at gmail dot com
` (4 preceding siblings ...)
2022-03-28 15:37 ` jakub at gcc dot gnu.org
@ 2022-03-30 7:17 ` cvs-commit at gcc dot gnu.org
2022-03-30 7:18 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-30 7:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105061
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:4f2795218a6ba6a7b7b9b18ca7a6e390661e1608
commit r12-7913-g4f2795218a6ba6a7b7b9b18ca7a6e390661e1608
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Mar 30 09:16:41 2022 +0200
c++: Fox template-introduction tentative parsing in class bodies clear
colon_corrects_to_scope_p [PR105061]
The concepts support (in particular template introductions from concepts
TS)
broke the following testcase, valid unnamed bitfields with dependent
types (or even just typedefs) were diagnosed as typos (: instead of correct
::) in template introduction during their tentative parsing.
The following patch fixes that by not doing this : to :: correction when
member_p is true.
2022-03-30 Jakub Jelinek <jakub@redhat.com>
PR c++/105061
* parser.cc (cp_parser_template_introduction): If member_p,
temporarily
clear parser->colon_corrects_to_scope_p around tentative parsing of
nested name specifier.
* g++.dg/concepts/pr105061.C: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/105061] [10/11/12 Regression] [c++2a+] anonymous bitfield templated offset rejected
2022-03-26 10:46 [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected wjwray at gmail dot com
` (5 preceding siblings ...)
2022-03-30 7:17 ` cvs-commit at gcc dot gnu.org
@ 2022-03-30 7:18 ` cvs-commit at gcc dot gnu.org
2022-03-30 7:19 ` [Bug c++/105061] [10 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-30 7:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105061
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:7b5a2b6e4f78395962835790c6d4a3e27ab8d378
commit r11-9738-g7b5a2b6e4f78395962835790c6d4a3e27ab8d378
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Mar 30 09:16:41 2022 +0200
c++: Fox template-introduction tentative parsing in class bodies clear
colon_corrects_to_scope_p [PR105061]
The concepts support (in particular template introductions from concepts
TS)
broke the following testcase, valid unnamed bitfields with dependent
types (or even just typedefs) were diagnosed as typos (: instead of correct
::) in template introduction during their tentative parsing.
The following patch fixes that by not doing this : to :: correction when
member_p is true.
2022-03-30 Jakub Jelinek <jakub@redhat.com>
PR c++/105061
* parser.c (cp_parser_template_introduction): If member_p,
temporarily
clear parser->colon_corrects_to_scope_p around tentative parsing of
nested name specifier.
* g++.dg/concepts/pr105061.C: New test.
(cherry picked from commit 4f2795218a6ba6a7b7b9b18ca7a6e390661e1608)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/105061] [10 Regression] [c++2a+] anonymous bitfield templated offset rejected
2022-03-26 10:46 [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected wjwray at gmail dot com
` (6 preceding siblings ...)
2022-03-30 7:18 ` cvs-commit at gcc dot gnu.org
@ 2022-03-30 7:19 ` jakub at gcc dot gnu.org
2022-05-10 8:25 ` cvs-commit at gcc dot gnu.org
2022-05-10 10:27 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-30 7:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105061
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Summary|[10/11/12 Regression] |[10 Regression] [c++2a+]
|[c++2a+] anonymous bitfield |anonymous bitfield
|templated offset rejected |templated offset rejected
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 11.3+ and 12.1+.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/105061] [10 Regression] [c++2a+] anonymous bitfield templated offset rejected
2022-03-26 10:46 [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected wjwray at gmail dot com
` (7 preceding siblings ...)
2022-03-30 7:19 ` [Bug c++/105061] [10 " jakub at gcc dot gnu.org
@ 2022-05-10 8:25 ` cvs-commit at gcc dot gnu.org
2022-05-10 10:27 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-10 8:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105061
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:3d8d22d7bd799fbdcddb4762a97c39d6107ee077
commit r10-10700-g3d8d22d7bd799fbdcddb4762a97c39d6107ee077
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Mar 30 09:16:41 2022 +0200
c++: Fox template-introduction tentative parsing in class bodies clear
colon_corrects_to_scope_p [PR105061]
The concepts support (in particular template introductions from concepts
TS)
broke the following testcase, valid unnamed bitfields with dependent
types (or even just typedefs) were diagnosed as typos (: instead of correct
::) in template introduction during their tentative parsing.
The following patch fixes that by not doing this : to :: correction when
member_p is true.
2022-03-30 Jakub Jelinek <jakub@redhat.com>
PR c++/105061
* parser.c (cp_parser_template_introduction): If member_p,
temporarily
clear parser->colon_corrects_to_scope_p around tentative parsing of
nested name specifier.
* g++.dg/concepts/pr105061.C: New test.
(cherry picked from commit 4f2795218a6ba6a7b7b9b18ca7a6e390661e1608)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/105061] [10 Regression] [c++2a+] anonymous bitfield templated offset rejected
2022-03-26 10:46 [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected wjwray at gmail dot com
` (8 preceding siblings ...)
2022-05-10 8:25 ` cvs-commit at gcc dot gnu.org
@ 2022-05-10 10:27 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-10 10:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105061
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 10.4 too.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-05-10 10:27 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-26 10:46 [Bug c++/105061] New: [9/10 Regression] [c++2a+] anonymous bitfield templated offset rejected wjwray at gmail dot com
2022-03-26 11:00 ` [Bug c++/105061] " wjwray at gmail dot com
2022-03-28 7:19 ` [Bug c++/105061] [10/11/12 " rguenth at gcc dot gnu.org
2022-03-28 9:51 ` jakub at gcc dot gnu.org
2022-03-28 10:07 ` jakub at gcc dot gnu.org
2022-03-28 15:37 ` jakub at gcc dot gnu.org
2022-03-30 7:17 ` cvs-commit at gcc dot gnu.org
2022-03-30 7:18 ` cvs-commit at gcc dot gnu.org
2022-03-30 7:19 ` [Bug c++/105061] [10 " jakub at gcc dot gnu.org
2022-05-10 8:25 ` cvs-commit at gcc dot gnu.org
2022-05-10 10:27 ` jakub 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).