|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - 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 07 2005
"Anuj Goyal" <Anuj_member pathlink.com> wrote in message news:d5jshk$d55$1 digitaldaemon.com... May 07 2005
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
May 08 2005
#### 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
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...
May 16 2005
|