![]() |
gcc bug ?
very complicated error. Maybe someone here has enough C++ knowledge :)
problem.cpp Code:
namespace util { Seems like specifying namespace is causing him trouble, because other 2 lines compile without error I'm using gcc 3.3.4. Am I doing something wrong or gcc has a bug ? EDIT : Well newest gcc is 3.4.1, so maybe I should upgrade, but I just want to know if problem is in gcc or in my code |
Re: gcc bug ?
my gcc 3.2 (mingw) compiles this code without problem
I'll start GNU/Linux and try with gcc 2.95 and 3.4.3 now... Edit in GNU/Linux: Yes you can just update to gcc 3.4.1 and the program will be solved... gcc 2.95 also has this bug. Also the "3.4.3" is a typo |
Re: gcc bug ?
here is report from gcc :
gcc -v -save-temps problem.cpp Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/specs Configured with: ../gcc-3.3.4/configure --prefix=/usr --enable-shared --enable-t hreads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose -- target=i486-slackware-linux --host=i486-slackware-linux Thread model: posix gcc version 3.3.4 /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/cc1plus -E -D__GNUG__=3 -quiet -v - D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=4 -D_GNU_SOURCE problem.cpp problem.ii ignoring nonexistent directory "/usr/i486-slackware-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/3.3.4 /usr/include/c++/3.3.4/i486-slackware-linux /usr/include/c++/3.3.4/backward /usr/local/include /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/include /usr/include End of search list. /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/cc1plus -fpreprocessed problem.ii - quiet -dumpbase problem.cpp -auxbase problem -version -o problem.s GNU C++ version 3.3.4 (i486-slackware-linux) compiled by GNU C version 3.3.4. GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128570 problem.cpp: In function `void this_cause_error()': problem.cpp:25: error: `util::sys' cannot be used as a function problem.cpp: In function `int main(int, char*)': problem.cpp:38: error: `util::sys' cannot be used as a function |
Re: gcc bug ?
By using util::sys() the compiler thinks you're trying to call a function [sys] in namespace util. The only thing it can match it against is a variable - hence the compiler output. If some variations of the compiler pick it up as a variable first, then it will still compile - the but the code is ambiguous in this respect and so should be changed anyway.
Also unless you mean to use things like operator overloading (+, -, *, /, etc) with a class, you should probably try and avoid the name "operator" for a function, as it may also cause a few complications. |
Re: gcc bug ?
Quote:
Code:
int operator() () {return 8;} |
All times are GMT +2. The time now is 23:49. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.