potential identifier collision in locale_facets.h

scott snyder snyder@d0sgibnl1.fnal.gov
Sat Apr 1 00:00:00 GMT 2000


hi -

It looks like Gaby's fix for the `mask' problem in locale_facets.h was
incomplete; the additional typedefs are also required in derived
classes of _Ctype<>.

The following input:

------------------------------------
int mask ();
#include <locale>
------------------------------------

still gives me errors, starting with:

In file included from inst/include/g++-v3/bits/std_locale.h:38,
                 from inst/include/g++-v3/locale:2,
                 from x.cc:2:
inst/include/g++-v3/bits/locale_facets.h:226: parse error before `)'
inst/include/g++-v3/bits/locale_facets.h:227: virtual outside class declaration
inst/include/g++-v3/bits/locale_facets.h:227: syntax error before `{'
inst/include/g++-v3/bits/locale_facets.h:229: missing ';' before right brace
inst/include/g++-v3/bits/locale_facets.h:231: syntax error before `*'



A patch is appended.

thanks,
sss


2000-03-13  scott snyder  <snyder@fnal.gov>

	* bits/locale_facets.h (class ctype<>, class ctype<char>, class
	ctype<wchar_t>): More mask fixes.
	* testsuite/22_locale/ctype.cc: Test for the problem.


Index: bits/locale_facets.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/locale_facets.h,v
retrieving revision 1.20
diff -u -p -r1.20 locale_facets.h
--- locale_facets.h	2000/03/09 20:42:16	1.20
+++ locale_facets.h	2000/03/13 21:07:21
@@ -211,6 +211,7 @@ namespace std
     {
       // Types:
       typedef _CharT 					char_type;
+      typedef typename _Ctype_nois<_CharT>::mask 	mask;
 
     public:
       explicit 
@@ -306,6 +307,7 @@ namespace std
       // Types:
       typedef char 					char_type;
       typedef size_t					__table_type;
+      typedef _Ctype_nois<char>::mask 			mask;
 
     private:
       // Data Members:
@@ -386,6 +388,7 @@ namespace std
      // Types:
       typedef wchar_t 					char_type;
       typedef size_t					__table_type;
+      typedef _Ctype_nois<wchar_t>::mask 		mask;
 
     private:
       __to_type const& 		_M_toupper;
Index: testsuite/22_locale/ctype.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/testsuite/22_locale/ctype.cc,v
retrieving revision 1.2
diff -u -p -r1.2 ctype.cc
--- ctype.cc	1999/11/19 09:09:11	1.2
+++ ctype.cc	2000/03/13 21:07:33
@@ -20,6 +20,10 @@
 
 // 22.2.1 the ctype category
 
+// Test that the locale headers are picking up the correct declaration
+// of the internal type `ctype_base::mask'.
+int mask ();
+
 #include <locale>
 
 // 1 should be able to instantiate this for other types besides char, wchar_t


More information about the Libstdc++ mailing list