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++/15943] New: Garbled message for invalid pointer to member conversions


Here's a piece of invalid code: 
-------------- 
struct a { 
    int x[8]; 
}; 
 
int main () { 
  int a::*n[8]; 
  n = &a::x; 
} 
-------------- 
The guy wrote this accidently allocated an array of 8 pointer-to-int-member, 
rather than a pointer-to-int[8]-member. The error message is garbled, though: 
 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc 
x.cc: In function `int main()': 
x.cc:8: error: incompatible types in assignment of `int a::*)[8]' to `int 
a::*[8]' 
 
Note that the first given type has only a single dangling parenthesis. This 
bug dates back to at least 2.95. 
 
W.

-- 
           Summary: Garbled message for invalid pointer to member
                    conversions
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at dealii dot org
                CC: gcc-bugs at gcc dot gnu dot org,gdr at gcc dot gnu dot
                    org


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


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