public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dirkmoermans at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/27339]  New: defining out-of-class specialization of value template parameter with private type
Date: Thu, 27 Apr 2006 16:28:00 -0000	[thread overview]
Message-ID: <bug-27339-12611@http.gcc.gnu.org/bugzilla/> (raw)

Following code does not compile with gcc 4.1.
It compiles with gcc 3.4.0 and gcc 4.0.2 and comeau online.

=============================
class A 
{
private: 
  enum private_enum {a};

  template<A::private_enum v>  // OK 
  struct B
  {
    void bm();
  }; 
public: 
  void am() 
  { 
    B<a> instance; //OK
    instance.bm();
  }
};

template<A::private_enum v>  // FAIL
void
A::B<v>::bm(){}
=============================
The error message is:
a.cc:4: error: 'enum A::private_enum' is private
a.cc:19: error: within this context

If the member template function gets defined inline, the code compiles. 
I don't have the c++ standard available, but a technicality like an
inline/outline definition should have no impact on the validity of the code
imho. 

The same error occurrs if the enum gets replaced by a function template
typedef, or if the inner-class gets replaced by a member-function-template.

A related bug is 10849


-- 
           Summary: defining out-of-class specialization of value template
                    parameter with private type
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dirkmoermans at gmail dot com


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


             reply	other threads:[~2006-04-27 16:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-27 16:28 dirkmoermans at gmail dot com [this message]
2006-04-27 19:29 ` [Bug c++/27339] [4.1/4.2 Regression]defining " pinskia at gcc dot gnu dot org
2006-04-30 16:29 ` [Bug c++/27339] [4.1/4.2 Regression] out-of-class definition " pinskia at gcc dot gnu dot org
2006-05-02 16:17 ` janis at gcc dot gnu dot org
2006-05-14 22:31 ` mmitchel at gcc dot gnu dot org
2006-05-15 23:16 ` mmitchel at gcc dot gnu dot org
2006-05-16  5:41 ` mmitchel at gcc dot gnu dot org
2006-05-16  5:43 ` mmitchel at gcc dot gnu dot org
2006-05-16 14:56 ` [Bug c++/27339] [4.1 " mmitchel at gcc dot gnu dot org
2006-05-16 14:56 ` mmitchel at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27339-12611@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).