public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads
@ 2007-11-02 17:44 andrew dot stubbs at st dot com
2007-11-02 18:45 ` [Bug c++/33984] " rguenth at gcc dot gnu dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: andrew dot stubbs at st dot com @ 2007-11-02 17:44 UTC (permalink / raw)
To: gcc-bugs
The following C++ program should not compile:
struct S {
unsigned int bar : 3;
} s;
int foo(unsigned int &);
int foo(double);
int
main ()
{
return foo(s.bar); // invalid
}
According to the C++ standard, clause 13.3.3.1.4, paragraph 4, the 'bar' should
match against 'foo(unsigned int &)' because both use unsigned int, not the
alternative overload, 'foo(double)'. However, it should then fail because a
bit-field may not be bound to a reference.
GCC 4.1.1 and 4.1.2 did this correctly.
GCC 4.2.0+ silently accept it. The call is incorrectly bound to foo(double).
--
Summary: [4.2/4.3 Regression] bit-fields, references and
overloads
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: andrew dot stubbs at st dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33984
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/33984] [4.2/4.3 Regression] bit-fields, references and overloads
2007-11-02 17:44 [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads andrew dot stubbs at st dot com
@ 2007-11-02 18:45 ` rguenth at gcc dot gnu dot org
2007-11-05 3:12 ` mmitchel at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-02 18:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2007-11-02 18:45 -------
Confirmed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-11-02 18:45:22
date| |
Target Milestone|--- |4.2.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33984
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/33984] [4.2/4.3 Regression] bit-fields, references and overloads
2007-11-02 17:44 [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads andrew dot stubbs at st dot com
2007-11-02 18:45 ` [Bug c++/33984] " rguenth at gcc dot gnu dot org
@ 2007-11-05 3:12 ` mmitchel at gcc dot gnu dot org
2007-11-12 18:04 ` janis at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-11-05 3:12 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33984
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/33984] [4.2/4.3 Regression] bit-fields, references and overloads
2007-11-02 17:44 [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads andrew dot stubbs at st dot com
2007-11-02 18:45 ` [Bug c++/33984] " rguenth at gcc dot gnu dot org
2007-11-05 3:12 ` mmitchel at gcc dot gnu dot org
@ 2007-11-12 18:04 ` janis at gcc dot gnu dot org
2007-11-29 15:14 ` jakub at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: janis at gcc dot gnu dot org @ 2007-11-12 18:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from janis at gcc dot gnu dot org 2007-11-12 18:04 -------
The mainline patch that caused this test to be accepted:
http://gcc.gnu.org/viewcvs?view=rev&rev=113199
r113199 | mmitchel | 2006-04-23 18:04:33 +0000 (Sun, 23 Apr 2006)
--
janis at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mmitchel at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33984
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/33984] [4.2/4.3 Regression] bit-fields, references and overloads
2007-11-02 17:44 [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads andrew dot stubbs at st dot com
` (2 preceding siblings ...)
2007-11-12 18:04 ` janis at gcc dot gnu dot org
@ 2007-11-29 15:14 ` jakub at gcc dot gnu dot org
2008-01-17 13:26 ` aoliva at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-29 15:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2007-11-29 15:14 -------
Created an attachment (id=14668)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14668&action=view)
gcc43-pr33984.patch
I've tried to fix this by the attached patch.
standard_conversion also uses is_bitfield_expr_with_lowered_type, but
reference_binding was not. Additionally, I've noticed that the 2006 change in
layout_class_type dropped all qualifiers from the bitfield's type if
c_build_bitfield_integer_type needs to be used.
Unfortunately this causes a regression on g++.old-deja/g++.robertl/eb5.C
- to type in this case is also the lowered bitfield type, so it fails.
Mark, any ideas?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33984
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/33984] [4.2/4.3 Regression] bit-fields, references and overloads
2007-11-02 17:44 [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads andrew dot stubbs at st dot com
` (3 preceding siblings ...)
2007-11-29 15:14 ` jakub at gcc dot gnu dot org
@ 2008-01-17 13:26 ` aoliva at gcc dot gnu dot org
2008-01-17 18:16 ` aoliva at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2008-01-17 13:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from aoliva at gcc dot gnu dot org 2008-01-17 12:43 -------
Mine
--
aoliva at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aoliva at gcc dot gnu dot
| |org
AssignedTo|unassigned at gcc dot gnu |aoliva at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33984
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/33984] [4.2/4.3 Regression] bit-fields, references and overloads
2007-11-02 17:44 [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads andrew dot stubbs at st dot com
` (4 preceding siblings ...)
2008-01-17 13:26 ` aoliva at gcc dot gnu dot org
@ 2008-01-17 18:16 ` aoliva at gcc dot gnu dot org
2008-01-20 21:22 ` mark at codesourcery dot com
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2008-01-17 18:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from aoliva at gcc dot gnu dot org 2008-01-17 18:01 -------
Created an attachment (id=14959)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14959&action=view)
Slight revision of Jakub's patch that fixes the regression
Getting built-in candidate functions not to use the bit-field types fixed the
regression Jakub noticed in his patch, and keeps the progression in place. I'm
almost done testing this, and I'll post it to gcc-patches then.
--
aoliva at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #14668|0 |1
is obsolete| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33984
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/33984] [4.2/4.3 Regression] bit-fields, references and overloads
2007-11-02 17:44 [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads andrew dot stubbs at st dot com
` (5 preceding siblings ...)
2008-01-17 18:16 ` aoliva at gcc dot gnu dot org
@ 2008-01-20 21:22 ` mark at codesourcery dot com
2008-01-22 8:42 ` aoliva at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mark at codesourcery dot com @ 2008-01-20 21:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from mark at codesourcery dot com 2008-01-20 20:28 -------
Subject: Re: [4.2/4.3 Regression] bit-fields, references and
overloads
aoliva at gcc dot gnu dot org wrote:
> ------- Comment #5 from aoliva at gcc dot gnu dot org 2008-01-17 18:01 -------
> Created an attachment (id=14959)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14959&action=view)
> --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14959&action=view)
> Slight revision of Jakub's patch that fixes the regression
>
> Getting built-in candidate functions not to use the bit-field types fixed the
> regression Jakub noticed in his patch, and keeps the progression in place. I'm
> almost done testing this, and I'll post it to gcc-patches then.
Thank you for working on this. I think this is the right idea, but I
have two comments:
* In add_builtin_candidates, I think you can just do:
argtypes[i] = unlowered_expr_type (lvalue_type (args[i]));
* In layout_class_type, I understand that you're trying to preserve
cv-qualification. I don't see a test case for that, though. If there's
a bug you're fixing here, let's have a test case for it.
Thanks,
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33984
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/33984] [4.2/4.3 Regression] bit-fields, references and overloads
2007-11-02 17:44 [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads andrew dot stubbs at st dot com
` (6 preceding siblings ...)
2008-01-20 21:22 ` mark at codesourcery dot com
@ 2008-01-22 8:42 ` aoliva at gcc dot gnu dot org
2008-01-23 2:13 ` aoliva at gcc dot gnu dot org
2008-01-23 2:20 ` aoliva at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2008-01-22 8:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from aoliva at gcc dot gnu dot org 2008-01-22 06:44 -------
Responded on gcc-patches, with revised patch.
http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00988.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33984
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/33984] [4.2/4.3 Regression] bit-fields, references and overloads
2007-11-02 17:44 [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads andrew dot stubbs at st dot com
` (7 preceding siblings ...)
2008-01-22 8:42 ` aoliva at gcc dot gnu dot org
@ 2008-01-23 2:13 ` aoliva at gcc dot gnu dot org
2008-01-23 2:20 ` aoliva at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2008-01-23 2:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from aoliva at gcc dot gnu dot org 2008-01-23 01:51 -------
Fixed.
--
aoliva at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33984
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/33984] [4.2/4.3 Regression] bit-fields, references and overloads
2007-11-02 17:44 [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads andrew dot stubbs at st dot com
` (8 preceding siblings ...)
2008-01-23 2:13 ` aoliva at gcc dot gnu dot org
@ 2008-01-23 2:20 ` aoliva at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2008-01-23 2:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from aoliva at gcc dot gnu dot org 2008-01-23 01:51 -------
Subject: Bug 33984
Author: aoliva
Date: Wed Jan 23 01:50:45 2008
New Revision: 131751
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131751
Log:
gcc/cp/ChangeLog:
PR c++/33984
* call.c (reference_binding): For bitfields use the declared bitfield
type.
(add_builtin_candidates): Likewise.
* class.c (layout_class_type): For bitfields copy over the
original type quals.
gcc/testsuite/ChangeLog:
PR c++/33984
* g++.dg/conversion/bitfield7.C: New test.
* g++.dg/cpp0x/decltype4.C: Fixed xfail.
Added:
trunk/gcc/testsuite/g++.dg/conversion/bitfield7.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/cp/class.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp0x/decltype4.C
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33984
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-01-23 1:52 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-02 17:44 [Bug c++/33984] New: [4.2/4.3 Regression] bit-fields, references and overloads andrew dot stubbs at st dot com
2007-11-02 18:45 ` [Bug c++/33984] " rguenth at gcc dot gnu dot org
2007-11-05 3:12 ` mmitchel at gcc dot gnu dot org
2007-11-12 18:04 ` janis at gcc dot gnu dot org
2007-11-29 15:14 ` jakub at gcc dot gnu dot org
2008-01-17 13:26 ` aoliva at gcc dot gnu dot org
2008-01-17 18:16 ` aoliva at gcc dot gnu dot org
2008-01-20 21:22 ` mark at codesourcery dot com
2008-01-22 8:42 ` aoliva at gcc dot gnu dot org
2008-01-23 2:13 ` aoliva at gcc dot gnu dot org
2008-01-23 2:20 ` aoliva at gcc dot gnu dot 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).