You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Farid Zaripov <Fa...@epam.com> on 2007/09/18 20:32:16 UTC

[MSVC 9.0] 'Unknown' enumerator conflict

  The 27.istream.unformatted.get.cpp and 27.istream.fmat.arith.cpp tests
are failed to compile
on MSVC 9.0 due to enum member name conflict:

tests\include\rw_streambuf.h(58) : error C2365: 'Unknown' :
redefinition; previous definition was 'enumerator'
        C:\Program Files\Microsoft
SDKs\Windows\v6.0A\include\winioctl.h(1635) : see declaration of
'Unknown'

rw_streambuf.h:
-----
enum MemFun {
    // bitmask with a bit for each virtual member function
[...]
    // bit OR-ed with MemFun bits
    Throw     = 0x1000,
    Failure   = 0x2000,
    Unknown   = 0x4000
};
-----

winioctl.h:
-----
typedef enum _MEDIA_TYPE {
    Unknown,                // Format is unknown
    F5_1Pt2_512,            // 5.25", 1.2MB,  512 bytes/sector
    F3_1Pt44_512,           // 3.5",  1.44MB, 512 bytes/sector
    F3_2Pt88_512,           // 3.5",  2.88MB, 512 bytes/sector
-----

  We need to rename it to something. I can't invent the suitable name,
unless adding the unredscores :)

  BTW it seems that this member is not used for now. Maybe we should
just remove it?

Farid.

Re: [MSVC 9.0] 'Unknown' enumerator conflict

Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
>   The 27.istream.unformatted.get.cpp and 27.istream.fmat.arith.cpp tests
> are failed to compile
> on MSVC 9.0 due to enum member name conflict:
> 
[...]
>   We need to rename it to something. I can't invent the suitable name,
> unless adding the unredscores :)
> 
>   BTW it seems that this member is not used for now. Maybe we should
> just remove it?

If it's not used for anything I say get rid of it :)

Another option, at least until we have strongly typed enums in
the language (see N2347:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf)
would be to make MemFun a struct around the enums:

     struct MemFun {
         enum {
             ...
             Throw     = 0x1000,
             Failure   = 0x2000,
             Unknown   = 0x4000
         };
     };

Martin