This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/23271] New: Members of ctype_base appear not to be integral constant expressions.


The trivial program below fails to compile when built with -pedantic -ansi
-Wall, the problem appears to be the value of std::ctype_base::print which can't
be assigned to an enum *but only on cygwin* and *only with the command line
options used above*.  I'm not completely sure if this is a setup problem with
libstdc++ on cygwin, or a gcc compiler bug.

Here's the program:


#include <locale>

   enum char_class_type
   {
      char_class_none = 0,
      char_class_alnum = std::ctype_base::alnum,
      char_class_alpha = std::ctype_base::alpha,
      char_class_cntrl = std::ctype_base::cntrl,
      char_class_digit = std::ctype_base::digit,
      char_class_graph = std::ctype_base::graph,
      char_class_lower = std::ctype_base::lower,
      char_class_print = std::ctype_base::print,
      char_class_punct = std::ctype_base::punct,
      char_class_space = std::ctype_base::space,
      char_class_upper = std::ctype_base::upper,
      char_class_xdigit = std::ctype_base::xdigit,
      char_class_all_base = char_class_alnum | char_class_alpha | char_class_cntrl
                         | char_class_digit | char_class_graph | char_class_lower
                         | char_class_print | char_class_punct | char_class_space
                         | char_class_upper | char_class_xdigit
   };

And here's the result:

$ g++ -c -pedantic -ansi -Wall ct*.cpp
ctype_base.cpp:13: error: overflow in constant expression
ctype_base.cpp:22: error: overflow in constant expression

Thanks in advance, 

John Maddock.

-- 
           Summary: Members of ctype_base appear not to be integral constant
                    expressions.
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john at johnmaddock dot co dot uk
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd
                    0.125)
  GCC host triplet: gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd
                    0.125)
GCC target triplet: gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd
                    0.125)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]