This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to fix PR9861
Tom Tromey writes:
> >>>>> "TJ" == TJ Laurenzo <tlaurenzo@gmail.com> writes:
>
> >> Also, constructors have no encoded return type. I guess that's OK,
> >> but I was rather surprised.
>
> TJ> The decision to exclude return types on constructors was based on a
> TJ> list of C++ rules for excluding return types for members of template
> TJ> classes.
>
> It is weird, but valid, to have a method with the class' name in java.
> Would we get a symbol clash for a class like this?
>
> public class Weird {
> public Weird (int x) { /* constructor */ }
> public int Weird() { return 5; /* method */ }
> }
No. A constructor that has no return type (not even void) doesn't
clash with any method name.
The constructor is
Weird.Weird(int) -> _ZN5WeirdC1Ei
The method is
Weird.Weird()int -> _ZN5Weird5WeirdEJiv
Andrew.