This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14057] New: error: conversion from `struct member*' to `enum PlayerNumber'


Source:

---
enum { TRACK_1, TRACK_2, TRACK_3, TRACK_4, TRACK_5 };
enum PlayerNumber { PLAYER_1, PLAYER_2 };
struct member { int x; };
struct x { member Member[2]; };

void foo()
{
        x Foo[2];
        PlayerNumber pn = PLAYER_1;
        int c=0;
        member Button = Foo[pn].Member[c];
}
---
That's as reduced as I could get it; it goes away if I replace pn or c in the 
last line with their values, use a scalar instead of "member", change pn to an 
int, etc.

g++  -v -save-temps  test.cc -c -Wall -W
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ../configure --prefix=/usr/local
Thread model: posix
gcc version 3.4.0 20040206 (prerelease)
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -E -quiet -v -
D_GNU_SOURCE test.cc -mtune=pentiumpro -Wall -W -o test.ii
ignoring nonexistent directory "/usr/local/lib/gcc/i686-pc-linux-
gnu/3.4.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/i686-
pc-linux-gnu
 /usr/local/lib/gcc/i686-pc-linux-
gnu/3.4.0/../../../../include/c++/3.4.0/backward
 /usr/local/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/include
 /usr/include
End of search list.
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -fpreprocessed test.ii -
quiet -dumpbase test.cc -mtune=pentiumpro -auxbase test -Wall -W -version -o 
test.s
GNU C++ version 3.4.0 20040206 (prerelease) (i686-pc-linux-gnu)
        compiled by GNU C version 3.3.3 20040125 (prerelease) (Debian).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=31849
test.cc: In function `void foo()':
test.cc:31: error: conversion from `struct member*' to `enum PlayerNumber'
test.cc:31: error: conversion from `struct member*' to `enum PlayerNumber'

-- 
           Summary: error: conversion from `struct member*' to `enum
                    PlayerNumber'
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: g_bugz at zewt dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gn
  GCC host triplet: i686-pc-linux-gn
GCC target triplet: i686-pc-linux-gn


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14057


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]