public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13594] New: namespace association vs. templates part two
@ 2004-01-07  3:06 bkoz at gcc dot gnu dot org
  2004-01-07  3:15 ` [Bug c++/13594] [3.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-01-07  3:06 UTC (permalink / raw)
  To: gcc-bugs

From:
http://gcc.gnu.org/ml/libstdc++/2004-01/msg00047.html

Ugh, more namespace association fallout. It looks like associated namespaces are
not being considered matches. This is probably related to (or the same as) the
other namespace association issue w/ std::swap that Richard Sandiford found.


#if 1
namespace std 
{
  template<typename T1, typename T2 = int>
    class vector;

  template<typename T1, typename T2> 
    class vector;  
}
#else
namespace __gnu_norm
{
  template<typename T1, typename T2 = int>
    class vector;
}

namespace std
{
  using namespace __gnu_norm __attribute__ ((strong));
}

namespace std 
{
  template<typename T1, typename T2> 
    class vector;  
}
#endif

class Foo { };
typedef std::vector<Foo> FooVec;

-- 
           Summary: namespace association vs. templates part two
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: jason at redhat dot com
        ReportedBy: bkoz at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,larsbj at gullik dot
                    net,rsandifo at redhat dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/13594] [3.4 Regression] namespace association vs. templates part two
  2004-01-07  3:06 [Bug c++/13594] New: namespace association vs. templates part two bkoz at gcc dot gnu dot org
@ 2004-01-07  3:15 ` pinskia at gcc dot gnu dot org
  2004-01-07 17:00 ` aoliva 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 @ 2004-01-07  3:15 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
           Keywords|                            |rejects-valid
            Summary|namespace association vs.   |[3.4 Regression] namespace
                   |templates part two          |association vs. templates
                   |                            |part two
   Target Milestone|---                         |3.4.0


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


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

* [Bug c++/13594] [3.4 Regression] namespace association vs. templates part two
  2004-01-07  3:06 [Bug c++/13594] New: namespace association vs. templates part two bkoz at gcc dot gnu dot org
  2004-01-07  3:15 ` [Bug c++/13594] [3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2004-01-07 17:00 ` aoliva at gcc dot gnu dot org
  2004-01-07 19:43 ` aoliva at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2004-01-07 17:00 UTC (permalink / raw)
  To: gcc-bugs



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


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


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

* [Bug c++/13594] [3.4 Regression] namespace association vs. templates part two
  2004-01-07  3:06 [Bug c++/13594] New: namespace association vs. templates part two bkoz at gcc dot gnu dot org
  2004-01-07  3:15 ` [Bug c++/13594] [3.4 Regression] " pinskia at gcc dot gnu dot org
  2004-01-07 17:00 ` aoliva at gcc dot gnu dot org
@ 2004-01-07 19:43 ` aoliva at gcc dot gnu dot org
  2004-01-07 21:02 ` aoliva at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2004-01-07 19:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From aoliva at gcc dot gnu dot org  2004-01-07 19:43 -------
Ok, this is tricky.  I can't quite tell what the meaning of attribute strong is
to be in the following two cases:

namespace foo { template <class T> class bar; }
namespace fool { template <class T> class bar; using namespace foo
attribute((strong)); }

it appears to me that the declarations of bar are not to be unified in this
case.  However, if I rewrite it like this:

namespace foo { template <class T> class bar; }
namespace fool { using namespace foo attribute((strong)); template <class T>
class bar; }

then it appears to me that the redeclaration of bar should resolve to foo::bar,
instead of introducing a new declaration in fool that hides foo::bar.

In fact, even name hiding is not the correct behavior in all cases.  Consider,
for example:

namespace foo { template <class T> void bar(T); }
namespace fool { template <class T> void bar(T, T); using namespace foo
attribute((strong)); }

should fool::bar(int) be valid, or should it be completely hidden by
fool:bar<T>(T,T)?  The behavior we have now is the latter, which is exactly what
causes the vector specialiation for swap to not be used, and to fail overload
resolution, in the testcase Richard Sandiford mentioned.  Since there are
definitions of swap in namespace std in <algorithm> and <string>, those in
__gnu_norm are never considered as part of namespace std, so we can't specialize
them as if they were in namespace std, so the extension fails to implement its
intended purpose (per the manual).

The reason unqualified lookups find the correct version is obviously Koenig
lookup, but it doesn't apply to qualified lookups.

So the decision we have to take now is how to address cases in which a name is
declared (and maybe defined) in more than one (associated or specified) namespace.

It appears to me that the right strategy is to look a name up in all associated
namespaces and, for functions, build an overload and, for classes, attempt some
form of unification or simply error out in case the name is multiply defined. 
The latter would rule out forward declarations of templates in the official (as
opposed to implementation) namespace.  Can we live with this?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-07 19:43:52
               date|                            |


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


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

* [Bug c++/13594] [3.4 Regression] namespace association vs. templates part two
  2004-01-07  3:06 [Bug c++/13594] New: namespace association vs. templates part two bkoz at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-01-07 19:43 ` aoliva at gcc dot gnu dot org
@ 2004-01-07 21:02 ` aoliva at gcc dot gnu dot org
  2004-01-12 16:42 ` bkoz at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2004-01-07 21:02 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jason at redhat dot com     |aoliva at gcc dot gnu dot
                   |                            |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/13594] [3.4 Regression] namespace association vs. templates part two
  2004-01-07  3:06 [Bug c++/13594] New: namespace association vs. templates part two bkoz at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-01-07 21:02 ` aoliva at gcc dot gnu dot org
@ 2004-01-12 16:42 ` bkoz at gcc dot gnu dot org
  2004-01-12 18:39 ` aoliva at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-01-12 16:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at gcc dot gnu dot org  2004-01-12 16:42 -------

Alexandre. Your patch for this introduced many new regressions in the libstdc++
testsuite, which tests the debug mode (which uses the namespace association bits.)

Did you test libstdc++?

-benjamin

-- 


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


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

* [Bug c++/13594] [3.4 Regression] namespace association vs. templates part two
  2004-01-07  3:06 [Bug c++/13594] New: namespace association vs. templates part two bkoz at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-01-12 16:42 ` bkoz at gcc dot gnu dot org
@ 2004-01-12 18:39 ` aoliva at gcc dot gnu dot org
  2004-01-15 14:42 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2004-01-12 18:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From aoliva at gcc dot gnu dot org  2004-01-12 18:39 -------
I meant to, but obviously I failed at that :-(  I have a patch that fixes some
of the outstanding regressions, but some others are related with bug 13659 (and
maybe bug 13658).  The actual bugs pre-date my patch, but the patch happened to
expose the latent bugs.

-- 


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


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

* [Bug c++/13594] [3.4 Regression] namespace association vs. templates part two
  2004-01-07  3:06 [Bug c++/13594] New: namespace association vs. templates part two bkoz at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-01-12 18:39 ` aoliva at gcc dot gnu dot org
@ 2004-01-15 14:42 ` cvs-commit at gcc dot gnu dot org
  2004-01-15 14:42 ` cvs-commit at gcc dot gnu dot org
  2004-01-15 17:44 ` aoliva at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-15 14:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-01-15 14:41 -------
Subject: Bug 13594

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aoliva@gcc.gnu.org	2004-01-15 14:41:49

Modified files:
	gcc/cp         : ChangeLog name-lookup.c 

Log message:
	PR c++/13594
	PR c++/13658
	* name-lookup.c (qualified_lookup_using_namespace): Search
	strongly-associated namespaces first, and only then try other
	namespaces.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3882&r2=1.3883
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.32&r2=1.33



-- 


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


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

* [Bug c++/13594] [3.4 Regression] namespace association vs. templates part two
  2004-01-07  3:06 [Bug c++/13594] New: namespace association vs. templates part two bkoz at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-01-15 14:42 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-15 14:42 ` cvs-commit at gcc dot gnu dot org
  2004-01-15 17:44 ` aoliva at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-15 14:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-01-15 14:42 -------
Subject: Bug 13594

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aoliva@gcc.gnu.org	2004-01-15 14:42:14

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/lookup: strong-using-2.C 

Log message:
	PR c++/13594
	* g++.dg/lookup/strong-using-2.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3378&r2=1.3379
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/strong-using-2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/13594] [3.4 Regression] namespace association vs. templates part two
  2004-01-07  3:06 [Bug c++/13594] New: namespace association vs. templates part two bkoz at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2004-01-15 14:42 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-15 17:44 ` aoliva at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2004-01-15 17:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From aoliva at gcc dot gnu dot org  2004-01-15 17:44 -------
Fixed

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


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


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

end of thread, other threads:[~2004-01-15 17:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-07  3:06 [Bug c++/13594] New: namespace association vs. templates part two bkoz at gcc dot gnu dot org
2004-01-07  3:15 ` [Bug c++/13594] [3.4 Regression] " pinskia at gcc dot gnu dot org
2004-01-07 17:00 ` aoliva at gcc dot gnu dot org
2004-01-07 19:43 ` aoliva at gcc dot gnu dot org
2004-01-07 21:02 ` aoliva at gcc dot gnu dot org
2004-01-12 16:42 ` bkoz at gcc dot gnu dot org
2004-01-12 18:39 ` aoliva at gcc dot gnu dot org
2004-01-15 14:42 ` cvs-commit at gcc dot gnu dot org
2004-01-15 14:42 ` cvs-commit at gcc dot gnu dot org
2004-01-15 17:44 ` aoliva 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).