Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-03

Implicit Operator Overloading

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mazola Winstrol

Hello,

Fpc: 3.0

Should the compiler to allow the definition of two operator overloading with the same parameters and diferent result types?

e.g:

==== code ====

  TMyRecord<T> record
     class operator Implicit(A: TMyRecord<T>): Real;
     class operator Implicit(A: TMyRecord<T>): Integer;
  end;

==== end ====

The code above doesn't compile. Error: function is already declared Public/Forward operator.

Best reagrds

Sven Barth
to Mazola Winstrol
"Mazola Winstrol" wrote 6 lines
Hello, Fpc: 3.0 Should the compiler to allow the definition of two operator overloading

with the same parameters and diferent result types?

Show quoted text 13 lines
e.g: ==== code ==== TMyRecord<T> record class operator Implicit(A: TMyRecord<T>): Real; class operator Implicit(A: TMyRecord<T>): Integer; end; ==== end ==== The code above doesn't compile. Error: function is already declared

Public/Forward operator.

Would you please test with trunk? I thought I had fixed that... If it doesn't work there either then please report as well.

Regards,
Sven

Mazola Winstrol
to Sven Barth

2016-03-07 3:53 GMT-03:00 Sven Barth :

Show quoted text 30 lines
Am 06.03.2016 22:09 schrieb "Mazola Winstrol" : > > Hello, > > Fpc: 3.0 > > Should the compiler to allow the definition of two operator overloading with the same parameters and diferent result types? > > e.g: > > ==== code ==== > > TMyRecord<T> record > class operator Implicit(A: TMyRecord<T>): Real; > class operator Implicit(A: TMyRecord<T>): Integer; > end; > > ==== end ==== > > The code above doesn't compile. Error: function is already declared Public/Forward operator. Would you please test with trunk? I thought I had fixed that... If it doesn't work there either then please report as well. Regards, Sven

Tested with the trunk version of the build 2016/04/10 (i dont know the revision number. i used the fcup tool to build). It works.

Regards

Sven Barth
to Mazola Winstrol
"Mazola Winstrol" wrote 10 lines
2016-03-07 3:53 GMT-03:00 Sven Barth : > > Am 06.03.2016 22:09 schrieb "Mazola Winstrol" : > > > > Hello, > > > > Fpc: 3.0 > > > > Should the compiler to allow the definition of two operator

overloading with the same parameters and diferent result types?

Show quoted text 13 lines
> > > > e.g: > > > > ==== code ==== > > > > TMyRecord<T> record > > class operator Implicit(A: TMyRecord<T>): Real; > > class operator Implicit(A: TMyRecord<T>): Integer; > > end; > > > > ==== end ==== > > > > The code above doesn't compile. Error: function is already declared

Public/Forward operator.

> > Would you please test with trunk? I thought I had fixed that... If it

doesn't work there either then please report as well.

Show quoted text 7 lines
> > Regards, > Sven > > Tested with the trunk version of the build 2016/04/10 (i dont know the

revision number. i used the fcup tool to build). It works.

Thanks for the heads up. Then I need to find which revision fixed this and have that merged to 3.0.1...

Regards,
Sven