Opened 20 years ago

Closed 19 years ago

#136 closed Bugs (None)

operator does not work under 3.2

Reported by: opiate Owned by: nobody
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

g++ -I.. -I../base -g -O2  -ftemplate-depth-32  -c
Var.cc -o Var.o
/usr/include/boost/cast.hpp: In function `Target
boost::numeric_cast(Source)
   [with Target = int, Source = poe::OpCode]':
Var.cc:452:   instantiated from here
/usr/include/boost/cast.hpp:344: creating array with
size zero (`false')
Var.cc:519:26: warning: pasting "operator" and "+" does
not give a valid preprocessing token
Var.cc:519:26: warning: pasting "&" and "add" does not
give a valid preprocessing token
... (many more lines of warnings with different operators)

Same class compiles fine under gcc-2.95

Part of Var's header:

  class Var
    : boost::totally_ordered<Var>,          // >, >=,
<=, etc.
      boost::incrementable<Var>,            // ++(Var)

      boost::totally_ordered<Var, int>,     // order vs
various types
      boost::totally_ordered<Var, double>,
      boost::totally_ordered<Var, OpCode>,
      boost::totally_ordered<Var, char>,
      boost::totally_ordered<Var, bool>,

      boost::integer_arithmetic<Var>,       // + - / * %
      boost::bitwise<Var>,                  // & | ^
      boost::shiftable<Var>                 // << >>
  {

Change History (2)

comment:1 by opiate, 20 years ago

Logged In: YES 
user_id=15747

Looks like I misfiled this -- it looks like a boost/cast
problem .  Sorry.

comment:2 by david_abrahams, 19 years ago

Status: assignedclosed
Logged In: YES 
user_id=52572

If you look at boost/cast.hpp, line 344, you'll see that the 
error you're seeing is a static assertion: it means that 
std::numeric_limits has to be specialized for poe::OpCode if 
you want to use numeric_cast on it.

Note: See TracTickets for help on using tickets.