Bug 27483 - Pointer to protected member
Summary: Pointer to protected member
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3
: P3 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-08 10:30 UTC by Wolfgang Roehrl
Modified: 2006-05-08 10:49 UTC (History)
1 user (show)

See Also:
Host: i386-pc-mingw32
Target: powerpc-wrs-vxworks
Build: sparc-sun-solaris2.5.1
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Roehrl 2006-05-08 10:30:35 UTC
Dear all,

I would like to post a bug report for the GNU C/C++ compiler 3.3-e500.

We use the compiler to generate code for a PowerPC processor.

Used invokation line for the GNU C++ compiler:

ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig
      -fmerge-templates -mmultiple -mno-string -mstrict-align -O3
      -fno-exceptions -fno-rtti -fno-builtin-printf
      -I<some include paths>
      -D<some #define's>
      X.CPP -oX.O


// file X.CPP

struct B
{
protected:
    void f (int);
};

void g (void (B::*)(int));

struct D : B
{
    void h1 () const { g (&B::f); }    // <--- line 11 (illegal)
    void h2 () const { g (&D::f); }    // <--- line 12 (legal)
};


The compiler ignores that line 11 is illegal with respect to 11.5/1: "If the
access is to form a pointer to member, the nested-name-specifier shall name
the derived class (or any class derived from that class)."
 
Kind regards
W. Roehrl
Comment 1 Richard Biener 2006-05-08 10:49:59 UTC
Fixed with the new C++ parser.