Bug 29469 - [DR 224] [4.2/4.3/4.4 Regression] error: non-template 'pair' used as template
Summary: [DR 224] [4.2/4.3/4.4 Regression] error: non-template 'pair' used as template
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.2
: P2 normal
Target Milestone: 4.3.4
Assignee: Jason Merrill
URL:
Keywords: rejects-valid
Depends on: 9634
Blocks: 29607
  Show dependency treegraph
 
Reported: 2006-10-14 17:37 UTC by Martin Michlmayr
Modified: 2009-03-04 19:40 UTC (History)
6 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-03-04 16:54:14


Attachments
testcase (410 bytes, text/plain)
2006-10-14 17:37 UTC, Martin Michlmayr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2006-10-14 17:37:12 UTC
The following example code compiled fine with 4.1.2 20060901 (Debian 4.1.1-13)
but fails with 4.1.2 20061007 (Debian 4.1.1-16).  I'm wondering whether this
change was intentional and whether there's a good reason for this change (in a
stable branch).

$ g++-4.1 -c pair.c
x.c:32: error: non-template 'pair' used as template
x.c:32: note: use 'avm_map<Key, Value, Compare, equal>::template pair' to indicate that it is a template
Comment 1 Martin Michlmayr 2006-10-14 17:37:28 UTC
Created attachment 12429 [details]
testcase
Comment 2 Andrew Pinski 2006-10-14 17:48:27 UTC
The real question is avm_map dependent inside the nested class?
I know there are C++ defect reports asking that question so ...
Comment 3 Andrew Pinski 2006-10-14 18:11:30 UTC
(In reply to comment #2)
> The real question is avm_map dependent inside the nested class?
> I know there are C++ defect reports asking that question so ...
And that is DR 224 which is in WP.
Comment 4 Andrew Pinski 2006-10-14 18:15:38 UTC
I think this is more complicated than just DR 224.
See PR 9634.
Comment 5 Andrew Pinski 2006-10-14 18:25:16 UTC
DR 224 says this is invalid code but GDR has mentioned that DR 224 is broken in really bad way:

template <class T> struct B : T
{
  void g(void) { B x; x.f(); }
}

struct A
{
  void f(void) {}
}

int main(void)
{
  B<A> t;
  t.g();
}

The above code would be invalid code with the resulution of DR 224.
Comment 6 pinskia@gmail.com 2006-10-14 18:26:41 UTC
Subject: Re:  [DR 224] error: non-template 'pair' used as
	template

On Sat, 2006-10-14 at 18:25 +0000, pinskia at gcc dot gnu dot org wrote:
> 
> ------- Comment #5 from pinskia at gcc dot gnu dot org  2006-10-14 18:25 -------
> DR 224 says this is invalid code 

Sorry valid code.

-- Pinski

Comment 7 Mark Mitchell 2006-11-13 03:40:15 UTC
Waiting for ISO Committee to decide what to do about DR 224.
Comment 8 Steven Bosscher 2007-12-16 23:20:32 UTC
Waiting for DR -> SUSPENDED.
Comment 9 Joseph S. Myers 2008-01-21 16:30:55 UTC
Bugs waiting for the committee should not be release-critical; we can restore this to P3 and reconsider the priority when unsuspending.
Comment 10 Joseph S. Myers 2008-07-04 21:37:36 UTC
Closing 4.1 branch.
Comment 11 Jason Merrill 2009-03-03 21:10:30 UTC
I don't see any open issues about DR 224 since it went into the WP.  Unsuspending, P3.
Comment 12 Jason Merrill 2009-03-04 18:42:42 UTC
Subject: Bug 29469

Author: jason
Date: Wed Mar  4 18:42:17 2009
New Revision: 144618

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144618
Log:
        PR c++/9634
        PR c++/29469
        PR c++/29607
        * decl.c (make_typename_type): Do look inside currently open classes.
        * parser.c (cp_parser_lookup_name): Likewise.
        (cp_parser_template_name): Likewise.
        * pt.c (dependent_scope_p): New function.
        * cp-tree.h: Declare it.
        * class.c (currently_open_class): Return fast if T isn't a class.

Added:
    trunk/gcc/testsuite/g++.dg/template/dependent-name5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog

Comment 13 Jason Merrill 2009-03-04 19:38:02 UTC
Subject: Bug 29469

Author: jason
Date: Wed Mar  4 19:37:43 2009
New Revision: 144621

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144621
Log:
        PR c++/9634
        PR c++/29469
        PR c++/29607
        Implement DR 224.
        * decl.c (make_typename_type): Do look inside currently open classes.
        * parser.c (cp_parser_lookup_name): Likewise.
        (cp_parser_template_name): Likewise.
        * pt.c (dependent_scope_p): New function.
        * cp-tree.h: Declare it.
        * class.c (currently_open_class): Return fast if T isn't a class.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/template/dependent-name5.C
      - copied unchanged from r144618, trunk/gcc/testsuite/g++.dg/template/dependent-name5.C
Modified:
    branches/gcc-4_3-branch/gcc/cp/ChangeLog
    branches/gcc-4_3-branch/gcc/cp/class.c
    branches/gcc-4_3-branch/gcc/cp/cp-tree.h
    branches/gcc-4_3-branch/gcc/cp/decl.c
    branches/gcc-4_3-branch/gcc/cp/parser.c
    branches/gcc-4_3-branch/gcc/cp/pt.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog

Comment 14 Jason Merrill 2009-03-04 19:40:47 UTC
Fixed for 4.3 and 4.4, not applying to 4.2.
Comment 15 Jason Merrill 2009-04-03 17:32:04 UTC
Subject: Bug 29469

Author: jason
Date: Fri Apr  3 17:31:38 2009
New Revision: 145510

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145510
Log:
Revert:
        PR c++/9634
        PR c++/29469
        PR c++/29607
        Implement DR 224.
        * decl.c (make_typename_type): Do look inside currently open classes.
        * parser.c (cp_parser_lookup_name): Likewise.
        (cp_parser_template_name): Likewise.
        * pt.c (dependent_scope_p): New function.
        * cp-tree.h: Declare it.
        * class.c (currently_open_class): Return fast if T isn't a class.

Removed:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/template/dependent-name5.C
Modified:
    branches/gcc-4_3-branch/gcc/cp/ChangeLog
    branches/gcc-4_3-branch/gcc/cp/class.c
    branches/gcc-4_3-branch/gcc/cp/cp-tree.h
    branches/gcc-4_3-branch/gcc/cp/decl.c
    branches/gcc-4_3-branch/gcc/cp/parser.c
    branches/gcc-4_3-branch/gcc/cp/pt.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog