public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53403] New: Function template friend denied access to private types of granting template class.
@ 2012-05-18 17:48 ibugs at qult dot net
  2012-05-18 17:38 ` [Bug c++/53403] " ibugs at qult dot net
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ibugs at qult dot net @ 2012-05-18 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53403
           Summary: Function template friend denied access to private
                    types of granting template class.
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ibugs@qult.net


The following code compiles with GCC 4.4 but not since 4.5, until at least
4.7.0.

  template <typename T>
  class Foo {
    typedef void    type;
    template <typename U> friend void f();
  public:
    Foo() {}
  };

  template class Foo<void>;

  template <typename T>
  void f()
  {
    typedef Foo<void>::type    type;
  }

  int main()
  {
    f<void>();
  }

If the function template is declared before the definition of the class
template, or if the Foo<void> class is instantiated after f's definition, the
code compiles.  The error appears only with private types, not other private
members.

Easy to work around, but still... :/


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

end of thread, other threads:[~2012-10-04 23:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-18 17:48 [Bug c++/53403] New: Function template friend denied access to private types of granting template class ibugs at qult dot net
2012-05-18 17:38 ` [Bug c++/53403] " ibugs at qult dot net
2012-05-18 19:44 ` daniel.kruegler at googlemail dot com
2012-05-19  0:02 ` redi at gcc dot gnu.org
2012-10-04 23:06 ` paolo.carlini at oracle dot com
2012-10-04 23:20 ` paolo at gcc dot gnu.org
2012-10-04 23:23 ` paolo.carlini at oracle dot com

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).