public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39786]  New: Qualified name lookup through different numbers of using directives
@ 2009-04-16 19:10 hstong at ca dot ibm dot com
  2009-04-17  9:14 ` [Bug c++/39786] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hstong at ca dot ibm dot com @ 2009-04-16 19:10 UTC (permalink / raw)
  To: gcc-bugs

It appears that qualified name lookup fails to find the correct candidate set
for overload resolution in the test case below.

For the following test case, the symptom is rejects-valid; however, it is
simple
to produce variants for wrong-code and accepts-invalid.

The Comeau online compiler compiles the test case successfully.

ISO/IEC 14882:2003 Sub-clause 3.4.3.2 [namespace.qual] paragraph 2:
===
Given X::m (where X is a user-declared namespace), or given ::m (where X is the
global namespace), let
S be the set of all declarations of m in X and in the transitive closure of all
namespaces nominated by
using-directives in X and its used namespaces, except that using-directives are
ignored in any namespace,
including X, directly containing one or more declarations of m.  No namespace
is searched more than once
in the lookup of a name.  If S is the empty set, the program is ill-formed. 
Otherwise, if S has exactly one
member, or if the context of the reference is a using-declaration (7.3.3), S is
the required set of declarations
of m.  Otherwise if the use of m is not one that allows a unique declaration to
be chosen from S, the program
is ill-formed.
===

We are looking for `f' from the global namespace.  The global namespace does
not directly contain a declaration
of `f'.  There are two namespaces nominated by using-directives in the global
namespace, ::A and ::B.

There are no using-directives in ::A.  ::B does not directly contain a
declaration of `f'.  There is a using-
directive in ::B nominating ::B::C.  There are no using-directives in ::B::C.

S is { ::A::f(char *), ::B::C::f(int) } and overload resolution on the call
`::f(0)' should pick ::B::C::f(int).

### Self-contained source (namelookup.C):
namespace A {
    char (*f(char *p))[13] { return 0; }
}

namespace B {
    namespace C {
        char (*f(int p))[42] { return 0; }
    }
    using namespace C;
}

using namespace B;
using namespace A;

char x[sizeof *::f(0) == 42 ? 1 : -1];


### Command to reproduce:
g++ -c namelookup.C


### Compiler output:
namelookup.C:15: error: size of array x is negative


### g++ -v output:
Using built-in specs.
Target: powerpc64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,java --enable-checking=release
--with-gxx-include-dir=/usr/include/c++/4.3 --enable-ssp --disable-libssp
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib
--enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --program-suffix=-4.3
--enable-linux-futex --without-system-libunwind --with-cpu=power4
--enable-secureplt --with-long-double-128 --build=powerpc64-suse-linux
Thread model: posix
gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux)


-- 
           Summary: Qualified name lookup through different numbers of using
                    directives
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hstong at ca dot ibm dot com
 GCC build triplet: powerpc64-suse-linux
  GCC host triplet: powerpc64-suse-linux
GCC target triplet: powerpc64-suse-linux


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


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

* [Bug c++/39786] [4.3/4.4/4.5 Regression] Qualified name lookup through different numbers of using directives
  2009-04-16 19:10 [Bug c++/39786] New: Qualified name lookup through different numbers of using directives hstong at ca dot ibm dot com
@ 2009-04-17  9:14 ` rguenth at gcc dot gnu dot org
  2009-04-22 13:34 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-17  9:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-04-17 09:14 -------
Confirmed.  The code was accepted with 3.3.6


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|4.1.2 4.3.2                 |4.1.2 4.3.2 4.5.0
      Known to work|                            |3.3.6
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-17 09:14:10
               date|                            |
            Summary|Qualified name lookup       |[4.3/4.4/4.5 Regression]
                   |through different numbers of|Qualified name lookup
                   |using directives            |through different numbers of
                   |                            |using directives
   Target Milestone|---                         |4.3.4


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


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

* [Bug c++/39786] [4.3/4.4/4.5 Regression] Qualified name lookup through different numbers of using directives
  2009-04-16 19:10 [Bug c++/39786] New: Qualified name lookup through different numbers of using directives hstong at ca dot ibm dot com
  2009-04-17  9:14 ` [Bug c++/39786] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
@ 2009-04-22 13:34 ` rguenth at gcc dot gnu dot org
  2009-08-04 12:48 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-22 13:34 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug c++/39786] [4.3/4.4/4.5 Regression] Qualified name lookup through different numbers of using directives
  2009-04-16 19:10 [Bug c++/39786] New: Qualified name lookup through different numbers of using directives hstong at ca dot ibm dot com
  2009-04-17  9:14 ` [Bug c++/39786] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
  2009-04-22 13:34 ` rguenth at gcc dot gnu dot org
@ 2009-08-04 12:48 ` rguenth at gcc dot gnu dot org
  2009-11-03 20:45 ` [Bug c++/39786] [4.3/4.4 " jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-04 12:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-08-04 12:30 -------
GCC 4.3.4 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.4                       |4.3.5


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


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

* [Bug c++/39786] [4.3/4.4 Regression] Qualified name lookup through different numbers of using directives
  2009-04-16 19:10 [Bug c++/39786] New: Qualified name lookup through different numbers of using directives hstong at ca dot ibm dot com
                   ` (2 preceding siblings ...)
  2009-08-04 12:48 ` rguenth at gcc dot gnu dot org
@ 2009-11-03 20:45 ` jason at gcc dot gnu dot org
  2009-11-03 20:53 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-03 20:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jason at gcc dot gnu dot org  2009-11-03 20:45 -------
This test now passes with 4.5, presumably because of

2009-10-28  Jason Merrill  <jason@redhat.com>

        Core issue 812, 861
        * name-lookup.c (set_decl_namespace): Deal properly with inline
        namespaces.
        (qualified_lookup_using_namespace): Overhaul.
        * pt.c (print_candidates): Handle getting an OVERLOAD.

I suppose I could apply the qualified_lookup_using_namespace hunk to 4.3 and
4.4.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
      Known to fail|4.1.2 4.3.2 4.4.0 4.5.0     |4.1.2 4.3.2 4.4.0
      Known to work|3.3.6                       |3.3.6 4.5.0
   Last reconfirmed|2009-04-17 09:14:10         |2009-11-03 20:45:45
               date|                            |
            Summary|[4.3/4.4/4.5 Regression]    |[4.3/4.4 Regression]
                   |Qualified name lookup       |Qualified name lookup
                   |through different numbers of|through different numbers of
                   |using directives            |using directives


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


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

* [Bug c++/39786] [4.3/4.4 Regression] Qualified name lookup through different numbers of using directives
  2009-04-16 19:10 [Bug c++/39786] New: Qualified name lookup through different numbers of using directives hstong at ca dot ibm dot com
                   ` (3 preceding siblings ...)
  2009-11-03 20:45 ` [Bug c++/39786] [4.3/4.4 " jason at gcc dot gnu dot org
@ 2009-11-03 20:53 ` jason at gcc dot gnu dot org
  2009-11-03 21:34 ` jason at gcc dot gnu dot org
  2009-11-03 22:09 ` jason at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-03 20:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jason at gcc dot gnu dot org  2009-11-03 20:52 -------
Subject: Bug 39786

Author: jason
Date: Tue Nov  3 20:52:30 2009
New Revision: 153865

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153865
Log:
        PR c++/39786
        * g++.dg/lookup/using22.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/lookup/using22.C
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/39786] [4.3/4.4 Regression] Qualified name lookup through different numbers of using directives
  2009-04-16 19:10 [Bug c++/39786] New: Qualified name lookup through different numbers of using directives hstong at ca dot ibm dot com
                   ` (4 preceding siblings ...)
  2009-11-03 20:53 ` jason at gcc dot gnu dot org
@ 2009-11-03 21:34 ` jason at gcc dot gnu dot org
  2009-11-03 22:09 ` jason at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-03 21:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2009-11-03 21:34 -------
Subject: Bug 39786

Author: jason
Date: Tue Nov  3 21:33:55 2009
New Revision: 153872

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153872
Log:
        PR c++/41876
        * parser.c (cp_parser_exception_declaration): Pass true to
        is_condition parm of cp_parser_type_specifier_seq.
        (cp_parser_omp_for_loop): Likewise.

        PR c++/39786, Core issue 812, 861
        * name-lookup.c (qualified_lookup_using_namespace): Overhaul.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/inline-ns3.C
      - copied unchanged from r153682,
trunk/gcc/testsuite/g++.dg/cpp0x/inline-ns3.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/lookup/using22.C
      - copied unchanged from r153865,
trunk/gcc/testsuite/g++.dg/lookup/using22.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/parse/eh-decl.C
      - copied unchanged from r153864,
trunk/gcc/testsuite/g++.dg/parse/eh-decl.C
Modified:
    branches/gcc-4_4-branch/gcc/cp/ChangeLog
    branches/gcc-4_4-branch/gcc/cp/name-lookup.c
    branches/gcc-4_4-branch/gcc/cp/parser.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/lookup/using16.C


-- 


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


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

* [Bug c++/39786] [4.3/4.4 Regression] Qualified name lookup through different numbers of using directives
  2009-04-16 19:10 [Bug c++/39786] New: Qualified name lookup through different numbers of using directives hstong at ca dot ibm dot com
                   ` (5 preceding siblings ...)
  2009-11-03 21:34 ` jason at gcc dot gnu dot org
@ 2009-11-03 22:09 ` jason at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-03 22:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jason at gcc dot gnu dot org  2009-11-03 22:09 -------
Fixed fer 4.4.3, 4.5.0.  I'm not comfortable applying the fix to 4.3 as it
might have unintended side-effects.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.3.5                       |4.4.3


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


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

end of thread, other threads:[~2009-11-03 22:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-16 19:10 [Bug c++/39786] New: Qualified name lookup through different numbers of using directives hstong at ca dot ibm dot com
2009-04-17  9:14 ` [Bug c++/39786] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
2009-04-22 13:34 ` rguenth at gcc dot gnu dot org
2009-08-04 12:48 ` rguenth at gcc dot gnu dot org
2009-11-03 20:45 ` [Bug c++/39786] [4.3/4.4 " jason at gcc dot gnu dot org
2009-11-03 20:53 ` jason at gcc dot gnu dot org
2009-11-03 21:34 ` jason at gcc dot gnu dot org
2009-11-03 22:09 ` jason 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).