Bug 23211

Summary: using dec in nested class doesn't import name
Product: gcc Reporter: Ivan Godard <igodard>
Component: c++Assignee: fabien
Severity: normal CC: fabien, fang, gcc-bugs, janis, nathan
Priority: P2 Keywords: diagnostic
Version: 3.4.0   
Target Milestone: 4.7.0   
Host: Target:
Build: Known to work: 3.3.4
Known to fail: 3.4.5, 4.0.2, 4.1.0 Last reconfirmed: 2006-07-05 09:32:47
Bug Depends on: 14258    
Bug Blocks:    

Description Ivan Godard 2005-08-03 00:22:40 UTC
template<typename T>
struct  foo {
    typedef int itype;
    typedef int jtype;
    struct bar {
        typedef typename foo::itype itype;
        using foo::jtype;
        itype i;
        jtype j;

gets you:
~/ootbc/members/src$ g++ foo.cc
foo.cc:9: error: `jtype' does not name a type

Adding "typename" here and there changes the error you get but doesn't compile.
The above code compiles OK on Comeau.
Comment 1 Andrew Pinski 2005-08-03 00:34:49 UTC
I think this is a dup of bug 14258.  GCC still implements the old using rules.
Comment 2 Wolfgang Bangerth 2005-09-14 15:28:34 UTC
Confirmed. This is a regression against 3.3 which compiled the code 
just fine. 
Comment 3 Andrew Pinski 2005-09-14 15:34:58 UTC
As I said, I think this is a dup of bug 14258, we never really got using correct.
Comment 4 Wolfgang Bangerth 2005-09-14 18:07:09 UTC
I'm not sure it is a duplicate, since the error messages are very 
different. But be that as it may, this is a regression and should 
be fixed. If it is, someone may want to take a look at that other 
PR as well. 
Comment 5 Andrew Pinski 2005-10-13 20:11:47 UTC
: Search converges between 2003-07-29-trunk (#308) and 2003-07-30-trunk (#309).
Comment 6 Mark Mitchell 2005-10-31 04:39:20 UTC
Leavinga s P2.  We should at least look at this, and understand what's wrong.
Comment 7 Mark Mitchell 2006-02-24 00:26:03 UTC
This issue will not be resolved in GCC 4.1.0; retargeted at GCC 4.1.1.
Comment 8 Mark Mitchell 2006-05-25 02:33:07 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 9 Andrew Pinski 2006-08-16 06:43:51 UTC
  Could you do a regression hunt on this bug?
Comment 10 Janis Johnson 2006-08-18 21:30:43 UTC
A regression hunt on powerpc-linux using the submitter's testcase identified the following patch:


    r69921 | nathan | 2003-07-29 11:16:50 +0000 (Tue, 29 Jul 2003)
Comment 11 Jason Merrill 2006-08-22 19:17:16 UTC
The using-declaration is invalid because foo is not a base of bar.  icc also rejects the testcase if you try to instantiate bar.
Comment 12 Ivan Godard 2006-08-22 20:28:07 UTC
If the "using" is invalid then there should be a diagnostic on line 7 that says so. 
Comment 13 Andrew Pinski 2006-08-22 20:30:57 UTC
So this is just a diagnostic issue and not a regression.
Comment 14 Ivan Godard 2006-08-22 20:38:04 UTC
Not, it's an error: invalid text is accepted without diagnostic (if the identifier introduced with the "using" is not itself used, then the using statement is invalid but gets no diagnostic).
Comment 15 fabien 2011-12-28 19:53:19 UTC
Author: fabien
Date: Wed Dec 28 19:53:14 2011
New Revision: 182711

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182711

2011-12-28  Fabien Chene  <fabien@gcc.gnu.org>

	PR c++/23211
	* g++.dg/template/using18.C: New.
	* g++.dg/template/using19.C: New.
	* g++.dg/template/nested3.C: Remove dg-message at instantiation.
	* g++.dg/template/crash13.C: Likewise.


2011-12-28  Fabien Chene  <fabien@gcc.gnu.org>

	PR c++/23211
	* name-lookup.c (do_class_using_decl): Use dependent_scope_p
	instead of dependent_type_p, to check that a non-dependent
	nested-name-specifier of a class-scope using declaration refers to
	a base, even if the current scope is dependent.
	* parser.c (cp_parser_using_declaration): Set
	USING_DECL_TYPENAME_P to 1 if the DECL is not null. Re-indent a
	'else' close to the prior modification.

Comment 16 fabien 2011-12-28 20:04:25 UTC