public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27979] New: conversion check confused by enum bitfields
@ 2006-06-09 16:52 tbm at cyrius dot com
2006-06-09 17:09 ` [Bug c++/27979] 4.2 Regression] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: tbm at cyrius dot com @ 2006-06-09 16:52 UTC (permalink / raw)
To: gcc-bugs
I think the following "invalid conversion" error, which is believe is wrong.
When I remove the bitfield, the program compile fine. In any case, the error
message isn't really optimal. :)
(sid)4502:tbm@test: ~/src] cat test.cpp
class Ast
{
enum AstKind { };
const AstKind kind : 8;
void foo(AstKind k) { }
void bar(void) { foo(kind); }
};
[with gcc 4.2 20060508]
(sid)4503:tbm@test: ~/src] /usr/lib/gcc-snapshot/bin/g++ -c test.cpp
test.cpp: In member function 'void Ast::bar()':
test.cpp:6: error: invalid conversion from 'unsigned char' to 'Ast::AstKind'
test.cpp:6: error: initializing argument 1 of 'void Ast::foo(Ast::AstKind)'
zsh: exit 1 /usr/lib/gcc-snapshot/bin/g++ -c test.cpp
[with gcc 4.2 20060530]
(sid)4504:tbm@test: ~/src] /usr/lib/gcc-snapshot/bin/g++ -c test.cpp
test.cpp: In member function 'void Ast::bar()':
test.cpp:6: error: invalid conversion from 'Ast::AstKind' to 'Ast::AstKind'
test.cpp:6: error: initializing argument 1 of 'void Ast::foo(Ast::AstKind)'
zsh: exit 1 /usr/lib/gcc-snapshot/bin/g++ -c test.cpp
(sid)4505:tbm@test: ~/src]
--
Summary: conversion check confused by enum bitfields
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tbm at cyrius dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27979
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/27979] 4.2 Regression] conversion check confused by enum bitfields
2006-06-09 16:52 [Bug c++/27979] New: conversion check confused by enum bitfields tbm at cyrius dot com
@ 2006-06-09 17:09 ` pinskia at gcc dot gnu dot org
2006-06-09 18:03 ` tbm at cyrius dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-09 17:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-06-09 16:56 -------
Confirmed, 4.1.0 accepted this code.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |rejects-valid
Known to fail| |4.2.0
Known to work| |4.1.0
Last reconfirmed|0000-00-00 00:00:00 |2006-06-09 16:56:28
date| |
Summary|conversion check confused by|4.2 Regression] conversion
|enum bitfields |check confused by enum
| |bitfields
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27979
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/27979] 4.2 Regression] conversion check confused by enum bitfields
2006-06-09 16:52 [Bug c++/27979] New: conversion check confused by enum bitfields tbm at cyrius dot com
2006-06-09 17:09 ` [Bug c++/27979] 4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-06-09 18:03 ` tbm at cyrius dot com
2006-06-09 18:10 ` tbm at cyrius dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tbm at cyrius dot com @ 2006-06-09 18:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from tbm at cyrius dot com 2006-06-09 17:47 -------
The following, related example, fails with gcc 4.2 20060508 but works with
20060530. It would be great if whoever works on this PR could check what
change was responsible to get this working, and if it was just an accidental
change, whether the following test case should be added to the test suite:
enum EBorderStyle {
BNATIVE, BNONE, BHIDDEN
};
class BorderValue
{
public:
EBorderStyle style : 8;
};
class bar
{
BorderValue *border;
EBorderStyle foo() { return border ? border->style : BHIDDEN; }
};
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27979
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/27979] 4.2 Regression] conversion check confused by enum bitfields
2006-06-09 16:52 [Bug c++/27979] New: conversion check confused by enum bitfields tbm at cyrius dot com
2006-06-09 17:09 ` [Bug c++/27979] 4.2 Regression] " pinskia at gcc dot gnu dot org
2006-06-09 18:03 ` tbm at cyrius dot com
@ 2006-06-09 18:10 ` tbm at cyrius dot com
2006-06-16 0:24 ` [Bug c++/27979] [4.2 " mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tbm at cyrius dot com @ 2006-06-09 18:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from tbm at cyrius dot com 2006-06-09 18:03 -------
It wasn't accidentally fixed. It was fixed by Mark Mitchell for PR c++/27506,
which contain the same test case as my 2nd example. In any case, the first
test case wasn't fixed by the fix for PR 27506.
--
tbm at cyrius dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at codesourcery dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27979
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/27979] [4.2 Regression] conversion check confused by enum bitfields
2006-06-09 16:52 [Bug c++/27979] New: conversion check confused by enum bitfields tbm at cyrius dot com
` (2 preceding siblings ...)
2006-06-09 18:10 ` tbm at cyrius dot com
@ 2006-06-16 0:24 ` mmitchel at gcc dot gnu dot org
2006-06-16 19:31 ` mmitchel at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-06-16 0:24 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27979
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/27979] [4.2 Regression] conversion check confused by enum bitfields
2006-06-09 16:52 [Bug c++/27979] New: conversion check confused by enum bitfields tbm at cyrius dot com
` (3 preceding siblings ...)
2006-06-16 0:24 ` [Bug c++/27979] [4.2 " mmitchel at gcc dot gnu dot org
@ 2006-06-16 19:31 ` mmitchel at gcc dot gnu dot org
2006-06-16 23:13 ` mmitchel at gcc dot gnu dot org
2006-06-16 23:45 ` mmitchel at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-06-16 19:31 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |mark at codesourcery dot com
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27979
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/27979] [4.2 Regression] conversion check confused by enum bitfields
2006-06-09 16:52 [Bug c++/27979] New: conversion check confused by enum bitfields tbm at cyrius dot com
` (4 preceding siblings ...)
2006-06-16 19:31 ` mmitchel at gcc dot gnu dot org
@ 2006-06-16 23:13 ` mmitchel at gcc dot gnu dot org
2006-06-16 23:45 ` mmitchel at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-06-16 23:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from mmitchel at gcc dot gnu dot org 2006-06-16 23:12 -------
Subject: Bug 27979
Author: mmitchel
Date: Fri Jun 16 23:12:08 2006
New Revision: 114733
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114733
Log:
PR c++/27979
* call.c (standard_conversion): Strip cv-qualifiers from bitfield
types.
PR c++/27979
* g++.dg/expr/bitfield2.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/expr/bitfield2.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27979
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/27979] [4.2 Regression] conversion check confused by enum bitfields
2006-06-09 16:52 [Bug c++/27979] New: conversion check confused by enum bitfields tbm at cyrius dot com
` (5 preceding siblings ...)
2006-06-16 23:13 ` mmitchel at gcc dot gnu dot org
@ 2006-06-16 23:45 ` mmitchel at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-06-16 23:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from mmitchel at gcc dot gnu dot org 2006-06-16 23:13 -------
Fixed in 4.2.0.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27979
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-06-16 23:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-09 16:52 [Bug c++/27979] New: conversion check confused by enum bitfields tbm at cyrius dot com
2006-06-09 17:09 ` [Bug c++/27979] 4.2 Regression] " pinskia at gcc dot gnu dot org
2006-06-09 18:03 ` tbm at cyrius dot com
2006-06-09 18:10 ` tbm at cyrius dot com
2006-06-16 0:24 ` [Bug c++/27979] [4.2 " mmitchel at gcc dot gnu dot org
2006-06-16 19:31 ` mmitchel at gcc dot gnu dot org
2006-06-16 23:13 ` mmitchel at gcc dot gnu dot org
2006-06-16 23:45 ` mmitchel 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).