>From the example in 7.3.4.1 (international standard
ISO/IEC 14882) we can conclude that
 the names introduced by using directive hide
 the names in higer level namespaces instead of
 resulting in an ill-formed code.
In the source code attached __false_type should
 be recognized correctly as comming from namespace
 _STL and should not conflict with the top level
 definition of __false_type. This is so since
 namespace std contains using namepsace _STL and
 the namespace _STL contains definition of
 __false_type too. 

Below is part of preprocesed file

$ gcc --version
gcc (GCC) 4.0.0 20050319 (prerelease)

compile command :
c++  -pthread -fexceptions -I../stlport -W -Wno-sign-compare \
     -Wno-unused -Wno-uninitialized -D_STLP_USE_GLIBC \
     -O0 -gstabs+ -g3 -fPIC -D_STLP_DEBUG -fPIC complex_exp.cpp \
     -c -o ../lib/obj/GCC-LINUX/DebugSTLD/complex_exp.o

next was cut from preprocesed complex_exp.i.cpp:
namespace std { }
namespace __std_alias = std;

namespace _STL {}
namespace std {
  using namespace _STL;
}

namespace _STL {
using namespace __std_alias;
}

namespace _STL {
    struct __true_type {};
    struct __false_type {};
    
    template <int _Is> struct __bool2type {
      typedef __false_type _Ret;                            // this is OK
    };
    template<>
    struct __bool2type<1> { typedef __true_type _Ret; };    // this is OK
}

namespace _STL {}
namespace std {
  using namespace _STL;
}

struct __true_type { };
struct __false_type { };

namespace std
{
  template<bool>
    struct __truth_type
    { typedef __false_type __type; };   // should be OK too, but report error:
'__false_type' does not name a type

  template<>
    struct __truth_type<true>
    { typedef __true_type __type; };    // should be OK too, but report error:
'__true_type' does not name a type

}

Whole file is too long (20000 row) - if it is needed please let me know,
I will send it.

(OS is Fedora core 3 at Linux kernel 2.6.9-1.667 #1 Tue Nov 2 14:41:25 EST 2004
i686 i686 i386 GNU/Linux)

-- 
           Summary: namespace bug
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jozef at syncad dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to