public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29470]  New: Using declaration access semantics change with templates
@ 2006-10-14 18:55 spam at david dot osborn dot name
  2006-10-14 19:02 ` [Bug c++/29470] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: spam at david dot osborn dot name @ 2006-10-14 18:55 UTC (permalink / raw)
  To: gcc-bugs

In the following class template, the protected using declaration causes the
inherited member to become publicly accessible.  The code compiles, even though
it shouldn't.

template <typename T> struct B
{
        protected:
        T v;
};
template <typename T> struct D : B<T>
{
        protected:
        using B<T>::v;
};
int main()
{
        D<int> d;
        d.v = 0;
        return 0;
}

$ g++ test.cpp

The same code without templates gives the correct behaviour and doesn't
compile.

struct B
{
        protected:
        int v;
};
struct D : B
{
        protected:
        using B::v;
};
int main()
{
        D d;
        d.v = 0;
        return 0;
}

$ g++ test.cpp
test.cpp: In function 'int main()':
test.cpp:4: error: 'int B::v' is protected
test.cpp:14: error: within this context

The preprocessed file from the template version is as follows:

# 1 "test.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.cpp"
template <typename T> struct B
{
 protected:
 T v;
};

template <typename T> struct D : B<T>
{
 protected:
 using B<T>::v;
};

int main()
{
 D<int> d;
 d.v = 0;
 return 0;
}


-- 
           Summary: Using declaration access semantics change with templates
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: spam at david dot osborn dot name
 GCC build triplet: i686-pc-mingw32
  GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32


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


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

* [Bug c++/29470] [4.1/4.2 Regression] Using declaration access semantics change with templates
  2006-10-14 18:55 [Bug c++/29470] New: Using declaration access semantics change with templates spam at david dot osborn dot name
@ 2006-10-14 19:02 ` pinskia at gcc dot gnu dot org
  2006-10-15 21:28 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-14 19:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-10-14 19:02 -------
Confirmed, a regression from 4.0.4.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|i686-pc-mingw32             |
   GCC host triplet|i686-pc-mingw32             |
 GCC target triplet|i686-pc-mingw32             |
           Keywords|                            |accepts-invalid
      Known to fail|                            |4.1.2 4.2.0 4.1.1
      Known to work|                            |4.0.4
   Last reconfirmed|0000-00-00 00:00:00         |2006-10-14 19:02:48
               date|                            |
            Summary|Using declaration access    |[4.1/4.2 Regression] Using
                   |semantics change with       |declaration access semantics
                   |templates                   |change with templates
   Target Milestone|---                         |4.1.2


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


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

* [Bug c++/29470] [4.1/4.2 Regression] Using declaration access semantics change with templates
  2006-10-14 18:55 [Bug c++/29470] New: Using declaration access semantics change with templates spam at david dot osborn dot name
  2006-10-14 19:02 ` [Bug c++/29470] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-10-15 21:28 ` mmitchel at gcc dot gnu dot org
  2006-10-16 23:50 ` janis at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-10-15 21:28 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=29470


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

* [Bug c++/29470] [4.1/4.2 Regression] Using declaration access semantics change with templates
  2006-10-14 18:55 [Bug c++/29470] New: Using declaration access semantics change with templates spam at david dot osborn dot name
  2006-10-14 19:02 ` [Bug c++/29470] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
  2006-10-15 21:28 ` mmitchel at gcc dot gnu dot org
@ 2006-10-16 23:50 ` janis at gcc dot gnu dot org
  2007-02-14  9:37 ` [Bug c++/29470] [4.1/4.2/4.3 " mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janis at gcc dot gnu dot org @ 2006-10-16 23:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janis at gcc dot gnu dot org  2006-10-16 23:49 -------
A regression hunt identified the following patch:

    http://gcc.gnu.org/viewcvs?view=rev&rev=100757

    r100757 | nathan | 2005-06-08 11:49:23 +0000 (Wed, 08 Jun 2005)


-- 

janis at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/29470] [4.1/4.2/4.3 Regression] Using declaration access semantics change with templates
  2006-10-14 18:55 [Bug c++/29470] New: Using declaration access semantics change with templates spam at david dot osborn dot name
                   ` (2 preceding siblings ...)
  2006-10-16 23:50 ` janis at gcc dot gnu dot org
@ 2007-02-14  9:37 ` mmitchel at gcc dot gnu dot org
  2008-07-04 21:39 ` [Bug c++/29470] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:37 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


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


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

* [Bug c++/29470] [4.2/4.3/4.4 Regression] Using declaration access semantics change with templates
  2006-10-14 18:55 [Bug c++/29470] New: Using declaration access semantics change with templates spam at david dot osborn dot name
                   ` (3 preceding siblings ...)
  2007-02-14  9:37 ` [Bug c++/29470] [4.1/4.2/4.3 " mmitchel at gcc dot gnu dot org
@ 2008-07-04 21:39 ` jsm28 at gcc dot gnu dot org
  2009-01-16 20:05 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 21:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jsm28 at gcc dot gnu dot org  2008-07-04 21:38 -------
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]
                   |Using declaration access    |Using declaration access
                   |semantics change with       |semantics change with
                   |templates                   |templates
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug c++/29470] [4.2/4.3/4.4 Regression] Using declaration access semantics change with templates
  2006-10-14 18:55 [Bug c++/29470] New: Using declaration access semantics change with templates spam at david dot osborn dot name
                   ` (4 preceding siblings ...)
  2008-07-04 21:39 ` [Bug c++/29470] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
@ 2009-01-16 20:05 ` jason at gcc dot gnu dot org
  2009-01-16 22:36 ` jason at gcc dot gnu dot org
  2009-01-16 22:46 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-01-16 20:05 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-10-14 19:02:48         |2009-01-16 20:05:23
               date|                            |


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


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

* [Bug c++/29470] [4.2/4.3/4.4 Regression] Using declaration access semantics change with templates
  2006-10-14 18:55 [Bug c++/29470] New: Using declaration access semantics change with templates spam at david dot osborn dot name
                   ` (5 preceding siblings ...)
  2009-01-16 20:05 ` jason at gcc dot gnu dot org
@ 2009-01-16 22:36 ` jason at gcc dot gnu dot org
  2009-01-16 22:46 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-01-16 22:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jason at gcc dot gnu dot org  2009-01-16 22:36 -------
Subject: Bug 29470

Author: jason
Date: Fri Jan 16 22:36:11 2009
New Revision: 143445

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143445
Log:
        PR c++/29470
        * pt.c (tsubst_decl) [USING_DECL]: Propagate access flags.

Added:
    trunk/gcc/testsuite/g++.dg/template/access20.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/torture/pr34641.C


-- 


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


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

* [Bug c++/29470] [4.2/4.3/4.4 Regression] Using declaration access semantics change with templates
  2006-10-14 18:55 [Bug c++/29470] New: Using declaration access semantics change with templates spam at david dot osborn dot name
                   ` (6 preceding siblings ...)
  2009-01-16 22:36 ` jason at gcc dot gnu dot org
@ 2009-01-16 22:46 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-01-16 22:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2009-01-16 22:46 -------
Fixed for 4.4, not fixing accepts-invalid on other branches.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-01-16 22:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-14 18:55 [Bug c++/29470] New: Using declaration access semantics change with templates spam at david dot osborn dot name
2006-10-14 19:02 ` [Bug c++/29470] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-10-15 21:28 ` mmitchel at gcc dot gnu dot org
2006-10-16 23:50 ` janis at gcc dot gnu dot org
2007-02-14  9:37 ` [Bug c++/29470] [4.1/4.2/4.3 " mmitchel at gcc dot gnu dot org
2008-07-04 21:39 ` [Bug c++/29470] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2009-01-16 20:05 ` jason at gcc dot gnu dot org
2009-01-16 22:36 ` jason at gcc dot gnu dot org
2009-01-16 22:46 ` 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).