[Bug c++/11296] New: gcc 3.2 fails to honor 14.6.4.2, p1, bullet 1

sebor at roguewave dot com gcc-bugzilla@gcc.gnu.org
Mon Jun 23 18:18:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: gcc 3.2 fails to honor 14.6.4.2, p1, bullet 1
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
                CC: gcc-bugs at gcc dot gnu dot org

The program below is expected to exit with a status of 0. Only symbols from the
definition context are to be considered during unqualified lookup (bullet 1),
and only symbols defined in associated namespaces in both the definition and
instantiation context are to be considered during Koenig lookup (bullet 2). When
compiled with gcc 3.2, the program returns 1 instead, indicating that gcc fails
to correctly implement 14.6.4.2, p1, bullet 1 in that it considers symbols
outside the definition context of N::bar during unqualified lookup. EDG eccp -A
(i.e., strict mode) implements the rules correctly. For a discussion of the
rules see the email thread at c++std-core@research.att.com starting with
c++std-core-10009.

$ cat t.cpp; g++ -static t.cpp && ./a.out ; echo $?
namespace N {
template <class T> T foo (T) { return T (); }
template <class T> T bar (T t) { return foo (t); }
}

struct S { S (int i = 0): i_ (i) { } int i_; };

namespace N {
/* template <> */ S foo (S) { return S (1); }
}

int main ()
{
     return 1 == N::bar (S ()).i_;
} 
1



More information about the Gcc-bugs mailing list