public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32519]  New: g++ allows access to protected template member functions of base class
@ 2007-06-27  2:56 gsayfan at numenta dot com
  2007-06-27 19:01 ` [Bug c++/32519] [4.1/4.2/4.3 regression] " bangerth at dealii dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gsayfan at numenta dot com @ 2007-06-27  2:56 UTC (permalink / raw)
  To: gcc-bugs

Derived classes may access protected members of their base class only on
themselves or other instances of the same type or derived type. Here is a link
to the relevant section in the draft of the C++ standard:

http://www.csci.csusb.edu/dick/c++std/cd2/access.html#class.protected

I don't have access to the actual standard, but I figure you do :-).

The bug occurs when the protected member is a template member function. If the
protected member is a simple data member the code fails to compile as it
should.

BTW, VC++ 2005 catches this bug and refuses to compile the test program.

Test Program (bug.cpp)
----------------------
struct B
{
protected:
  template <typename T>
  T getX()
  {
    return T(x);
  }
protected:
  int x;
};

struct D : public B
{
  D(B * b)
  {
    //x = b->x;         // fails to compile (correct)
    x = b->getX<int>(); // doesn't fail to compile (bug)
  }
};

int main (int argc, char * const argv[]) 
{
  B b;
  D d(&b);
}

Output of gcc -v
----------------
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../src/gcc-4.0.2/configure  : (reconfigured)
../src/gcc-4.0.2/configure 
Thread model: posix
gcc version 4.0.2

Build command
-------------
g++ -Wall bug.cpp -o bug


-- 
           Summary: g++ allows access to protected template member functions
                    of base class
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gsayfan at numenta dot com


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/32519] [4.1/4.2/4.3 regression] g++ allows access to protected template member functions of base class
  2007-06-27  2:56 [Bug c++/32519] New: g++ allows access to protected template member functions of base class gsayfan at numenta dot com
@ 2007-06-27 19:01 ` bangerth at dealii dot org
  2007-07-04  3:31 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2007-06-27 19:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bangerth at dealii dot org  2007-06-27 19:01 -------
Confirmed, a regression apparently introduced in 3.4.x.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |accepts-invalid
      Known to fail|                            |3.4.3 4.1.0
      Known to work|                            |2.95.3 3.2.3 3.3.6
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-27 19:01:01
               date|                            |
            Summary|g++ allows access to        |[4.1/4.2/4.3 regression] g++
                   |protected template member   |allows access to protected
                   |functions of base class     |template member functions of
                   |                            |base class
   Target Milestone|---                         |4.2.1


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/32519] [4.1/4.2/4.3 regression] g++ allows access to protected template member functions of base class
  2007-06-27  2:56 [Bug c++/32519] New: g++ allows access to protected template member functions of base class gsayfan at numenta dot com
  2007-06-27 19:01 ` [Bug c++/32519] [4.1/4.2/4.3 regression] " bangerth at dealii dot org
@ 2007-07-04  3:31 ` mmitchel at gcc dot gnu dot org
  2007-07-20  3:52 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-04  3:31 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/32519] [4.1/4.2/4.3 regression] g++ allows access to protected template member functions of base class
  2007-06-27  2:56 [Bug c++/32519] New: g++ allows access to protected template member functions of base class gsayfan at numenta dot com
  2007-06-27 19:01 ` [Bug c++/32519] [4.1/4.2/4.3 regression] " bangerth at dealii dot org
  2007-07-04  3:31 ` mmitchel at gcc dot gnu dot org
@ 2007-07-20  3:52 ` mmitchel at gcc dot gnu dot org
  2007-10-09 19:30 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-20  3:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.1                       |4.2.2


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/32519] [4.1/4.2/4.3 regression] g++ allows access to protected template member functions of base class
  2007-06-27  2:56 [Bug c++/32519] New: g++ allows access to protected template member functions of base class gsayfan at numenta dot com
                   ` (2 preceding siblings ...)
  2007-07-20  3:52 ` mmitchel at gcc dot gnu dot org
@ 2007-10-09 19:30 ` mmitchel at gcc dot gnu dot org
  2008-02-01 17:05 ` jsm28 at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-10-09 19:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from mmitchel at gcc dot gnu dot org  2007-10-09 19:21 -------
Change target milestone to 4.2.3, as 4.2.2 has been released.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.2                       |4.2.3


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/32519] [4.1/4.2/4.3 regression] g++ allows access to protected template member functions of base class
  2007-06-27  2:56 [Bug c++/32519] New: g++ allows access to protected template member functions of base class gsayfan at numenta dot com
                   ` (3 preceding siblings ...)
  2007-10-09 19:30 ` mmitchel at gcc dot gnu dot org
@ 2008-02-01 17:05 ` jsm28 at gcc dot gnu dot org
  2008-05-19 20:27 ` [Bug c++/32519] [4.1/4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-02-01 17:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jsm28 at gcc dot gnu dot org  2008-02-01 16:54 -------
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.3                       |4.2.4


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/32519] [4.1/4.2/4.3/4.4 regression] g++ allows access to protected template member functions of base class
  2007-06-27  2:56 [Bug c++/32519] New: g++ allows access to protected template member functions of base class gsayfan at numenta dot com
                   ` (4 preceding siblings ...)
  2008-02-01 17:05 ` jsm28 at gcc dot gnu dot org
@ 2008-05-19 20:27 ` jsm28 at gcc dot gnu dot org
  2008-07-04 22:48 ` [Bug c++/32519] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-05-19 20:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jsm28 at gcc dot gnu dot org  2008-05-19 20:23 -------
4.2.4 is being released, changing milestones to 4.2.5.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.4                       |4.2.5


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/32519] [4.2/4.3/4.4 regression] g++ allows access to protected template member functions of base class
  2007-06-27  2:56 [Bug c++/32519] New: g++ allows access to protected template member functions of base class gsayfan at numenta dot com
                   ` (5 preceding siblings ...)
  2008-05-19 20:27 ` [Bug c++/32519] [4.1/4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
@ 2008-07-04 22:48 ` jsm28 at gcc dot gnu dot org
  2008-09-05 13:24 ` fabien dot chene at gmail dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 22:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jsm28 at gcc dot gnu dot org  2008-07-04 22:47 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2/4.3/4.4 regression]|[4.2/4.3/4.4 regression] g++
                   |g++ allows access to        |allows access to protected
                   |protected template member   |template member functions of
                   |functions of base class     |base class


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/32519] [4.2/4.3/4.4 regression] g++ allows access to protected template member functions of base class
  2007-06-27  2:56 [Bug c++/32519] New: g++ allows access to protected template member functions of base class gsayfan at numenta dot com
                   ` (6 preceding siblings ...)
  2008-07-04 22:48 ` [Bug c++/32519] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
@ 2008-09-05 13:24 ` fabien dot chene at gmail dot com
  2008-11-28 22:27 ` jason at gcc dot gnu dot org
  2008-12-04 15:06 ` jason at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: fabien dot chene at gmail dot com @ 2008-09-05 13:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from fabien dot chene at gmail dot com  2008-09-05 13:22 -------
There is a patch here:
http://gcc.gnu.org/ml/gcc-patches/2008-09/msg00474.html


-- 

fabien dot chene at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fabien dot chene at gmail
                   |                            |dot com


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/32519] [4.2/4.3/4.4 regression] g++ allows access to protected template member functions of base class
  2007-06-27  2:56 [Bug c++/32519] New: g++ allows access to protected template member functions of base class gsayfan at numenta dot com
                   ` (7 preceding siblings ...)
  2008-09-05 13:24 ` fabien dot chene at gmail dot com
@ 2008-11-28 22:27 ` jason at gcc dot gnu dot org
  2008-12-04 15:06 ` jason at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-11-28 22:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jason at gcc dot gnu dot org  2008-11-28 22:26 -------
Subject: Bug 32519

Author: jason
Date: Fri Nov 28 22:24:49 2008
New Revision: 142264

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142264
Log:
        PR c++/32519
        * g++.dg/template/pr32519.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/pr32519.C


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/32519] [4.2/4.3/4.4 regression] g++ allows access to protected template member functions of base class
  2007-06-27  2:56 [Bug c++/32519] New: g++ allows access to protected template member functions of base class gsayfan at numenta dot com
                   ` (8 preceding siblings ...)
  2008-11-28 22:27 ` jason at gcc dot gnu dot org
@ 2008-12-04 15:06 ` jason at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-12-04 15:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jason at gcc dot gnu dot org  2008-12-04 15:02 -------
Fixed a while back; ChangeLog entry had wrong PR number.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-12-04 15:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-27  2:56 [Bug c++/32519] New: g++ allows access to protected template member functions of base class gsayfan at numenta dot com
2007-06-27 19:01 ` [Bug c++/32519] [4.1/4.2/4.3 regression] " bangerth at dealii dot org
2007-07-04  3:31 ` mmitchel at gcc dot gnu dot org
2007-07-20  3:52 ` mmitchel at gcc dot gnu dot org
2007-10-09 19:30 ` mmitchel at gcc dot gnu dot org
2008-02-01 17:05 ` jsm28 at gcc dot gnu dot org
2008-05-19 20:27 ` [Bug c++/32519] [4.1/4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2008-07-04 22:48 ` [Bug c++/32519] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2008-09-05 13:24 ` fabien dot chene at gmail dot com
2008-11-28 22:27 ` jason at gcc dot gnu dot org
2008-12-04 15:06 ` jason at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).