c++ - bug? duplicate declaration?
- Anuj Goyal (20/20) May 07 2005 xerces 2.6.0 has a file very similar to this:
- Walter (6/25) May 07 2005 The 'static' isn't in the example code??
- Anuj Goyal (43/73) May 08 2005 my apologies, I posted the wrong code.... unfortunatley this one has mor...
- Anuj Goyal (35/35) May 08 2005 #### something with statics is causing a problem.
- Walter (1/1) May 08 2005 Looks like a compiler bug.
- Anuj Goyal (1/2) May 28 2005
- Matthew (6/85) May 16 2005 I've been experiencing similar const confusions with DMC++ in STLSoft, i...
xerces 2.6.0 has a file very similar to this: #include <stdio.h> class XMLString { public: const wchar_t* findAny (); wchar_t* findAny (); private: int a; }; int main() { return 0; } C:\ws>dmc -cpp xmlstring.cpp static wchar_t *findAny (); ^ xmlstring.cpp(7) : Error: 'XMLString::findAny' is already defined --- errorlevel 1 g++ 3.3.3 does not err whist compiling. Neither does xlc, aCC, or studio
May 07 2005
"Anuj Goyal" <Anuj_member pathlink.com> wrote in message news:d5jshk$d55$1 digitaldaemon.com...xerces 2.6.0 has a file very similar to this: #include <stdio.h> class XMLString { public: const wchar_t* findAny (); wchar_t* findAny (); private: int a; }; int main() { return 0; } C:\ws>dmc -cpp xmlstring.cpp static wchar_t *findAny (); ^ xmlstring.cpp(7) : Error: 'XMLString::findAny' is already definedThe 'static' isn't in the example code??--- errorlevel 1That's correct. After all, for: findAny(); how can the compiler tell which function to call?
May 07 2005
my apologies, I posted the wrong code.... unfortunatley this one has more complexity. from XMLString.hpp (xerces 260) C:\ws>cat xmlstring.cpp #include <stdio.h> class XMLString { public: static const char* findAny ( const char* const a, const char* const b); static char* findAny ( char* const a, const char* const b); }; int main () { return 0; } C:\ws>dmc xmlstring.cpp static char* findAny ( char* const a, const char* const b); ^ xmlstring.cpp(7) : Error: 'XMLString::findAny' is already defined --- errorlevel 1 [0305][u35354354 infong242:work]$ [0305][u35354354 infong242:work]$ [0305][u35354354 infong242:work]$ cat xmlstring.cpp #include <stdio.h> class XMLString { public: static const char* findAny ( const char* const a, const char* const b); static char* findAny ( char* const a, const char* const b); }; int main() { return 0; } [0305][u35354354 infong242:work]$ g++ -v Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs gcc version 2.95.4 20011002 (Debian prerelease) [0305][u35354354 infong242:work]$ g++ xmlstring.cpp [0305][u35354354 infong242:work]$ #no error"Anuj Goyal" <Anuj_member pathlink.com> wrote in message news:d5jshk$d55$1 digitaldaemon.com...xerces 2.6.0 has a file very similar to this: #include <stdio.h> class XMLString { public: const wchar_t* findAny (); wchar_t* findAny (); private: int a; }; int main() { return 0; } C:\ws>dmc -cpp xmlstring.cpp static wchar_t *findAny (); ^ xmlstring.cpp(7) : Error: 'XMLString::findAny' is already definedThe 'static' isn't in the example code??--- errorlevel 1That's correct. After all, for: findAny(); how can the compiler tell which function to call?
May 08 2005
C:\ws>cat xmlstring.cpp #include <stdio.h> class XMLString { public: static const char* findAny ( const char* const a); static char* findAny ( char* const a); }; int main () { return 0; } C:\ws>dmc -cpp xmlstring.cpp static char* findAny ( char* const a); ^ xmlstring.cpp(7) : Error: 'XMLString::findAny' is already defined --- errorlevel 1 C:\ws>cat xmlstring.cpp #include <stdio.h> class XMLString { public: const char* findAny ( const char* const a); char* findAny ( char* const a); }; int main () { return 0; } C:\ws>dmc -cpp xmlstring.cpp link xmlstring,,,user32+kernel32/noi;
May 08 2005
can it be fixed? or is it a FOL (fact of life).Looks like a compiler bug.
May 28 2005
I've been experiencing similar const confusions with DMC++ in STLSoft, in terms of making a pointer-to-const const itself, i.e. template <typename C> C const *someFunc(C const *s1, C const *const s2, C delim); DMC++ fails to find an instantiation of someFunc() unless s2 is changed to be "C const*". "Anuj Goyal" <Anuj_member pathlink.com> wrote in message news:d5kdso$q45$1 digitaldaemon.com...my apologies, I posted the wrong code.... unfortunatley this one has more complexity. from XMLString.hpp (xerces 260) C:\ws>cat xmlstring.cpp #include <stdio.h> class XMLString { public: static const char* findAny ( const char* const a, const char* const b); static char* findAny ( char* const a, const char* const b); }; int main () { return 0; } C:\ws>dmc xmlstring.cpp static char* findAny ( char* const a, const char* const b); ^ xmlstring.cpp(7) : Error: 'XMLString::findAny' is already defined --- errorlevel 1 [0305][u35354354 infong242:work]$ [0305][u35354354 infong242:work]$ [0305][u35354354 infong242:work]$ cat xmlstring.cpp #include <stdio.h> class XMLString { public: static const char* findAny ( const char* const a, const char* const b); static char* findAny ( char* const a, const char* const b); }; int main() { return 0; } [0305][u35354354 infong242:work]$ g++ -v Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs gcc version 2.95.4 20011002 (Debian prerelease) [0305][u35354354 infong242:work]$ g++ xmlstring.cpp [0305][u35354354 infong242:work]$ #no error"Anuj Goyal" <Anuj_member pathlink.com> wrote in message news:d5jshk$d55$1 digitaldaemon.com...xerces 2.6.0 has a file very similar to this: #include <stdio.h> class XMLString { public: const wchar_t* findAny (); wchar_t* findAny (); private: int a; }; int main() { return 0; } C:\ws>dmc -cpp xmlstring.cpp static wchar_t *findAny (); ^ xmlstring.cpp(7) : Error: 'XMLString::findAny' is already definedThe 'static' isn't in the example code??--- errorlevel 1That's correct. After all, for: findAny(); how can the compiler tell which function to call?
May 16 2005