| Thread overview | |||||||||
|---|---|---|---|---|---|---|---|---|---|
|
May 08, 2005 bug? duplicate declaration? | ||||
|---|---|---|---|---|
| ||||
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 08, 2005 Re: bug? duplicate declaration? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Anuj Goyal | "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 defined The 'static' isn't in the example code?? > --- errorlevel 1 That's correct. After all, for: findAny(); how can the compiler tell which function to call? | |||
May 08, 2005 Re: bug? duplicate declaration? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter | my apologies, I posted the wrong code.... unfortunatley this one has more complexity. from XMLString.hpp (xerces 260) ### DMC 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 ### g++ [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 defined > >The 'static' isn't in the example code?? > >> --- errorlevel 1 > >That's correct. After all, for: > findAny(); >how can the compiler tell which function to call? > > | |||
May 08, 2005 Re: bug? duplicate declaration? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Anuj Goyal | #### something with statics is causing a problem. 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 ##### with 'static' gone it compiles. 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 Re: bug? duplicate declaration? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Anuj Goyal | Looks like a compiler bug. | |||
May 17, 2005 Re: bug? duplicate declaration? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Anuj Goyal | 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)
>
> ### DMC
> 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
>
>
>
>
> ### g++
> [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 defined
>>
>>The 'static' isn't in the example code??
>>
>>> --- errorlevel 1
>>
>>That's correct. After all, for:
>> findAny();
>>how can the compiler tell which function to call?
>>
>>
>
>
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply