public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17669] New: Scope mismatch
@ 2004-09-25 15:59 trick at icculus dot org
  2004-09-25 16:01 ` [Bug c++/17669] " trick at icculus dot org
  2004-09-25 16:27 ` [Bug libstdc++/17669] " pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: trick at icculus dot org @ 2004-09-25 15:59 UTC (permalink / raw)
  To: gcc-bugs

The following little "program", which used to work fine in gcc 3.3, results in a
scope error when compiled with gcc 3.4.  Replacing "char_traits" in the code
below with "std::char_traits" makes it compile without error.  So, it seems g++
doesn't use the "using namespace std" for char_traits, somehow.

I tried to just include the relevant parts of what showed up in the preprocessed
file, but then the problem went away, so this is unfortunately the most minimal
test I was able to get.  (ext/pod_char_traits.h is from libstdc++)

--- 8< ---
$ cat test.cpp
#include <ext/pod_char_traits.h>

using namespace std;
using namespace __gnu_cxx;

typedef character<unsigned short, int> WCHAR;

typedef basic_string<WCHAR, char_traits<WCHAR>, allocator<WCHAR> > WSTRING;

$ g++ -c test.cpp
test.cpp:8: error: `char_traits' was not declared in this scope
test.cpp:8: error: template argument 2 is invalid
test.cpp:8: error: expected unqualified-id before ',' token
test.cpp:8: error: expected init-declarator before '>' token
test.cpp:8: error: expected `,' or `;' before '>' token

$ diff -u test.cpp test2.cpp
--- test.cpp    2004-09-25 17:44:56.883215224 +0200
+++ test2.cpp   2004-09-25 17:49:47.230075792 +0200
@@ -5,4 +5,4 @@

 typedef character<unsigned short, int> WCHAR;

-typedef basic_string<WCHAR, char_traits<WCHAR>, allocator<WCHAR> > WSTRING;
+typedef basic_string<WCHAR, std::char_traits<WCHAR>, allocator<WCHAR> > WSTRING;

$ g++ -c test2.cpp
$
$ gcc -v
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.2/specs
Configured with: /var/tmp/portage/gcc-3.4.2-r1/work/gcc-3.4.2/configure
--enable-version-specific-runtime-libs --prefix=/usr
--bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.2/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.2/include/g++-v3
--host=i686-pc-linux-gnu --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-shared --with-system-zlib
--disable-checking --disable-werror --disable-libunwind-exceptions --with-gnu-ld
--enable-threads=posix --disable-multilib --enable-languages=c,c++,objc,java
Thread model: posix
gcc version 3.4.2  (Gentoo Linux 3.4.2-r1, ssp-3.4.1-1, pie-8.7.6.5)

--- 8< ---

I'll attach the preprocessed file of test.cpp.

- Gerry

-- 
           Summary: Scope mismatch
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: trick at icculus dot org
                CC: gcc-bugs at gcc dot gnu dot org
 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=17669


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

* [Bug c++/17669] Scope mismatch
  2004-09-25 15:59 [Bug c++/17669] New: Scope mismatch trick at icculus dot org
@ 2004-09-25 16:01 ` trick at icculus dot org
  2004-09-25 16:27 ` [Bug libstdc++/17669] " pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: trick at icculus dot org @ 2004-09-25 16:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From trick at icculus dot org  2004-09-25 16:01 -------
Created an attachment (id=7218)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7218&action=view)
test.ii

Proprocessed file (obtained from "g++ --save-temps -c test.cpp")

-- 


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


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

* [Bug libstdc++/17669] Scope mismatch
  2004-09-25 15:59 [Bug c++/17669] New: Scope mismatch trick at icculus dot org
  2004-09-25 16:01 ` [Bug c++/17669] " trick at icculus dot org
@ 2004-09-25 16:27 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-25 16:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-25 16:27 -------
char_traits is defined in both namespaces std and __gnu_cxx, there is another bug already about the 
error message.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c++                         |libstdc++
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2004-09-25 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-25 15:59 [Bug c++/17669] New: Scope mismatch trick at icculus dot org
2004-09-25 16:01 ` [Bug c++/17669] " trick at icculus dot org
2004-09-25 16:27 ` [Bug libstdc++/17669] " pinskia 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).