[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#251225: g++: `xor', `or' and `and' can't be identifiers



Package: g++
Version: 3:3.3-2
Severity: minor



-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux suffix 2.4.24 #1 Wed Jan 14 09:52:19 CET 2004 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages g++ depends on:
ii  cpp                           3:3.3-2    The GNU C preprocessor.
ii  g++-3.3                       1:3.3.1-1  The GNU C++ compiler
ii  gcc-3.3                       1:3.3.1-1  The GNU C compiler

Hi,

I would like to submit the following bug-report:


Recently I tried to compile the following source:

    void or()
    {}

When compiling this function, the following compilation error was reported:

    demo.cc:1: error: syntax error before `||' token

Next I did several small additional tests:

    - The same kind of error was produced with the `and' and `xor'
        identifiers. 

    - The same kind of error was produced with the `and' and `xor' identifiers
        used in variable declarations.

    - When the source is offered to the C compiler no errors are reported
        (compiler: 
            cc --version
            cc (GCC) 3.3.1 (Debian)
        )

    - Using a namespace doesn't prevent the error. 

    - The error does not occur using another C++ compiler on other hardware
            (IRIX64 hpv 6.5 04100803 IP35) 
        using its C++ compiler 
            (MIPSpro Compilers: Version 7.3.1.2m)

    - `or', `and' and `xor' are not C++ keywords.

As the problem is not occurring with another type of compiler and as the
identifier(s) aren't keywords, I suspect there might be a glitch in the lexical
scanner, returning OR-tokens for both '||' and 'or'.

Kind regards,

Frank B. Brokken.




Reply to: