public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27339]  New: defining out-of-class specialization of value template parameter with private type
@ 2006-04-27 16:28 dirkmoermans at gmail dot com
  2006-04-27 19:29 ` [Bug c++/27339] [4.1/4.2 Regression]defining " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dirkmoermans at gmail dot com @ 2006-04-27 16:28 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug c++/27339] [4.1/4.2 Regression]defining out-of-class specialization of value template parameter with private type
  2006-04-27 16:28 [Bug c++/27339] New: defining out-of-class specialization of value template parameter with private type dirkmoermans at gmail dot com
@ 2006-04-27 19:29 ` 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
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-27 19:29 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |normal
           Keywords|                            |rejects-valid
            Summary|defining out-of-class       |[4.1/4.2 Regression]defining
                   |specialization of value     |out-of-class specialization
                   |template parameter with     |of value template parameter
                   |private type                |with private type
   Target Milestone|---                         |4.1.1


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


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

* [Bug c++/27339] [4.1/4.2 Regression] out-of-class definition of value template parameter with private type
  2006-04-27 16:28 [Bug c++/27339] New: defining out-of-class specialization of value template parameter with private type dirkmoermans at gmail dot com
  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 ` pinskia at gcc dot gnu dot org
  2006-05-02 16:17 ` janis at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30 16:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-04-30 16:29 -------
Confirmed.

Janis, could you do a regression hunt on this bug?
Thanks.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janis at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-04-30 16:29:22
               date|                            |
            Summary|[4.1/4.2 Regression]out-of- |[4.1/4.2 Regression] out-of-
                   |class definition of value   |class definition of value
                   |template parameter with     |template parameter with
                   |private type                |private type


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


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

* [Bug c++/27339] [4.1/4.2 Regression] out-of-class definition of value template parameter with private type
  2006-04-27 16:28 [Bug c++/27339] New: defining out-of-class specialization of value template parameter with private type dirkmoermans at gmail dot com
  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
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: janis at gcc dot gnu dot org @ 2006-05-02 16:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janis at gcc dot gnu dot org  2006-05-02 16:16 -------
A regression hunt on powerpc-linux identified this patch:

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

    r105682 | mmitchel | 2005-10-20 18:01:52 +0000 (Thu, 20 Oct 2005)


-- 

janis at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/27339] [4.1/4.2 Regression] out-of-class definition of value template parameter with private type
  2006-04-27 16:28 [Bug c++/27339] New: defining out-of-class specialization of value template parameter with private type dirkmoermans at gmail dot com
                   ` (2 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-14 22:31 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug c++/27339] [4.1/4.2 Regression] out-of-class definition of value template parameter with private type
  2006-04-27 16:28 [Bug c++/27339] New: defining out-of-class specialization of value template parameter with private type dirkmoermans at gmail dot com
                   ` (3 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-15 23:16 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/27339] [4.1/4.2 Regression] out-of-class definition of value template parameter with private type
  2006-04-27 16:28 [Bug c++/27339] New: defining out-of-class specialization of value template parameter with private type dirkmoermans at gmail dot com
                   ` (4 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-16  5:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mmitchel at gcc dot gnu dot org  2006-05-16 05:40 -------
Subject: Bug 27339

Author: mmitchel
Date: Tue May 16 05:39:49 2006
New Revision: 113819

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113819
Log:
        PR c++/27339
        * cp-tree.h (perform_access_checks): New function.
        * semantics.c (perform_access_checks): New function.
        (perform_deferred_access_checks): Use it.
        * parser.c (cp_parser_simple_declaration): Adjust call to
        cp_parser_init_declarator.
        (cp_parser_type_parameter): Do not defer checks in default
        arguments.
        (cp_parser_explicit_specialization): Adjust call to
        cp_parser_single_declaration.
        (cp_parser_init_declarator): Perform template-parameter access
        checks. 
        (cp_parser_parameter_declaration): Do not defer checks for
        template parameter default arguments.
        (cp_parser_template_declaration_after_export): Gather access
        checks for template parameters, and pass them to
        cp_parser_single_declaration.
        (cp_parser_template_parameter_access_checks): New function.
        (cp_parser_single_declaration): Add checks parameter.
        PR c++/27339
        * g++.dg/parser/access8.C: Adjust error marker.
        * g++.dg/template/access17.C: New test.
        * g++.dg/template/access18.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/template/access17.C
    trunk/gcc/testsuite/g++.dg/template/access18.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/parse/access8.C


-- 


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


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

* [Bug c++/27339] [4.1/4.2 Regression] out-of-class definition of value template parameter with private type
  2006-04-27 16:28 [Bug c++/27339] New: defining out-of-class specialization of value template parameter with private type dirkmoermans at gmail dot com
                   ` (5 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-16  5:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mmitchel at gcc dot gnu dot org  2006-05-16 05:43 -------
Fixed in 4.2.0.


-- 


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


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

* [Bug c++/27339] [4.1 Regression] out-of-class definition of value template parameter with private type
  2006-04-27 16:28 [Bug c++/27339] New: defining out-of-class specialization of value template parameter with private type dirkmoermans at gmail dot com
                   ` (7 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-16 14:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from mmitchel at gcc dot gnu dot org  2006-05-16 14:55 -------
Subject: Bug 27339

Author: mmitchel
Date: Tue May 16 14:54:55 2006
New Revision: 113825

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113825
Log:
        PR c++/27339
        * cp-tree.h (perform_access_checks): New function.
        * semantics.c (perform_access_checks): New function.
        (perform_deferred_access_checks): Use it.
        * parser.c (cp_parser_simple_declaration): Adjust call to
        cp_parser_init_declarator.
        (cp_parser_type_parameter): Do not defer checks in default
        arguments.
        (cp_parser_explicit_specialization): Adjust call to
        cp_parser_single_declaration.
        (cp_parser_init_declarator): Perform template-parameter access
        checks. 
        (cp_parser_parameter_declaration): Do not defer checks for
        template parameter default arguments.
        (cp_parser_template_declaration_after_export): Gather access
        checks for template parameters, and pass them to
        cp_parser_single_declaration.
        (cp_parser_template_parameter_access_checks): New function.
        (cp_parser_single_declaration): Add checks parameter.
        PR c++/27339
        * g++.dg/parser/access8.C: Adjust error marker.
        * g++.dg/template/access17.C: New test.
        * g++.dg/template/access18.C: Likewise.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/access17.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/access18.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/cp-tree.h
    branches/gcc-4_1-branch/gcc/cp/parser.c
    branches/gcc-4_1-branch/gcc/cp/semantics.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/parse/access8.C


-- 


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


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

* [Bug c++/27339] [4.1 Regression] out-of-class definition of value template parameter with private type
  2006-04-27 16:28 [Bug c++/27339] New: defining out-of-class specialization of value template parameter with private type dirkmoermans at gmail dot com
                   ` (6 preceding siblings ...)
  2006-05-16  5:43 ` mmitchel at gcc dot gnu dot org
@ 2006-05-16 14:56 ` mmitchel at gcc dot gnu dot org
  2006-05-16 14:56 ` mmitchel at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-16 14:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mmitchel at gcc dot gnu dot org  2006-05-16 14:55 -------
Fixed in 4.1.1.


-- 

mmitchel at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-05-16 14:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-27 16:28 [Bug c++/27339] New: defining out-of-class specialization of value template parameter with private type dirkmoermans at gmail dot com
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

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