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:[EMAIL PROTECTED]: ~/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:[EMAIL PROTECTED]: ~/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:[EMAIL PROTECTED]: ~/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:[EMAIL PROTECTED]: ~/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

Reply via email to