[Bug c++/14875] New: No or in function names allowed

j dot werner at physik dot uni-stuttgart dot de gcc-bugzilla@gcc.gnu.org
Wed Apr 7 11:58:00 GMT 2004


The following code fails to compile using gcc-3.4: 
 
Sample.hpp: 
#ifndef __SAMPLE__ 
#define __SAMPLE__ 
 
using namespace std; 
 
class Sample 
{ 
 
public: 
  Sample::Sample(); 
  void Sample::or(long Digital); 
}; 
 
#endif 
 
Sample.cpp: 
#include "Sample.hpp" 
 
Sample::Sample() 
{ 
} 
 
void Sample::or(long Digital) 
{ 
} 
 
joerg@uhldingen:~$ LANG=C g++-3.4 -v -save-temps Sample.cpp 
Reading specs from /usr/lib/gcc/i486-linux/3.4.0/specs 
Configured with: ../src/configure -v 
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr 
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 
--enable-shared --with-system-zlib --enable-nls --enable-threads=posix 
--without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit 
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm 
--enable-java-awt=gtk --disable-werror i486-linux 
Thread model: posix 
gcc version 3.4.0 20040403 (prerelease) (Debian) 
 /usr/lib/gcc/i486-linux/3.4.0/cc1plus -E -quiet -v -D_GNU_SOURCE Sample.cpp 
-mtune=i486 -o Sample.ii 
ignoring nonexistent directory 
"/usr/lib/gcc/i486-linux/3.4.0/../../../../i486-linux/include" 
#include "..." search starts here: 
#include <...> search starts here: 
 /usr/include/c++/3.4 
 /usr/include/c++/3.4/i486-linux 
 /usr/include/c++/3.4/backward 
 /usr/local/include 
 /usr/lib/gcc/i486-linux/3.4.0/include 
 /usr/include 
End of search list. 
 /usr/lib/gcc/i486-linux/3.4.0/cc1plus -fpreprocessed Sample.ii -quiet 
-dumpbase Sample.cpp -mtune=i486 -auxbase Sample -version -o Sample.s 
GNU C++ version 3.4.0 20040403 (prerelease) (Debian) (i486-linux) 
        compiled by GNU C version 3.4.0 20040403 (prerelease) (Debian). 
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64362 
In file included from Sample.cpp:1: 
Sample.hpp:11: error: expected unqualified-id before '||' token 
Sample.hpp:11: error: abstract declarator `void' used as declaration 
Sample.hpp:11: error: variable or field `type name' declared void 
Sample.hpp:11: error: expected `;' before '||' token 
Sample.cpp:7: error: expected unqualified-id before '||' token 
Sample.cpp:7: error: expected init-declarator before '||' token 
Sample.cpp:7: error: expected `,' or `;' before '||' token 
 
 
Sample.ii: 
# 1 "Sample.cpp" 
# 1 "<built-in>" 
# 1 "<command line>" 
# 1 "Sample.cpp" 
# 1 "Sample.hpp" 1 
 
 
 
using namespace std; 
 
class Sample 
{ 
 
public: 
  Sample::Sample(); 
  void Sample::or(long Digital); 
}; 
# 2 "Sample.cpp" 2 
 
Sample::Sample() 
{ 
} 
 
void Sample::or(long Digital) 
{ 
} 
 
Is or in function names not allowed? 
 
Greetings, 
 
Jörg

-- 
           Summary: No or in function names allowed
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: j dot werner at physik dot uni-stuttgart dot de
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list