Bug report - a constant value in a switch statement

Ryszard Kabatek Ryszard.Kabatek@softax.pl
Wed May 23 23:24:00 GMT 2001


Hi.

In te sample below I get the folowing error message
from gcc version 3.0 20010514 (prerelease).

g++ -Wall x.cc

x.cc: In function `int f(std::_Ios_Openmode)':
x.cc:6: case label does not reduce to an integer constant


#include <iostream>
 
int f(std::ios_base::openmode mode)
{
  switch(mode & ~std::ios_base::ate) {
     case std::ios_base::out | std::ios_base::trunc:
        return 1;
  }
  return 0;
} 

The values of ate, out and trunc are integer constants.
It is a compiler bug.

Regards
-- 
Ryszard Kabatek



More information about the Gcc-bugs mailing list