------- Comment #2 from pinskia at gmail dot com  2008-10-11 17:05 -------
Subject: Re:   New: Nested type leaks to global scope



Sent from my iPhone

On Oct 11, 2008, at 5:28 AM, "therealfroggey at gmail dot com"
<[EMAIL PROTECTED] 
 > wrote:

> GCC versions used:
> gcc version 4.1.2
> gcc version 4.4.0 20081011 (experimental) (GCC) svn revision 141055
> Command line used: g++ -Wall -Wextra bug.cc
>
> The following code should fail to compile as Internal_B is a private  
> class
> within class A.
> Both tested version of gcc successfully compile it with no warnings.
>
> ------------
>
> template <typename T>
> class A
> {
> private:
>  class Internal_A
>  {
>    friend class Internal_B;

The above friend class refers to the class in containing namespace and  
not to the class inside the class.

>
>  };
>  class Internal_B { };
>  Internal_A a;
> };
>
> A<int> a;
>
> Internal_B some_function();

The above should not compile but it is not because the inner class is  
leaking though. It is because the friend statement is causing an  
injection when it should not.

>
>
>
> -- 
>           Summary: Nested type leaks to global scope
>           Product: gcc
>           Version: 4.4.0
>            Status: UNCONFIRMED
>          Severity: normal
>          Priority: P3
>         Component: c++
>        AssignedTo: unassigned at gcc dot gnu dot org
>        ReportedBy: therealfroggey at gmail dot com
> GCC build triplet: x86_64-linux-gnu
>  GCC host triplet: x86_64-linux-gnu
> GCC target triplet: x86_64-linux-gnu
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37804
>


-- 


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

Reply via email to