refInt = ref int: how to achieve this? or is this a bug?

MoonlightSentinel moonlightsentinel at disroot.org
Wed Jun 17 22:48:25 UTC 2020


On Wednesday, 17 June 2020 at 22:33:50 UTC, mw wrote:
> We are talking about pass either `ptr` or `ref` to other 
> functions here.

To quote some more of your previous post:

> My thought is that: pointer and reference are all types of its 
> own right:
>
> typedef `int*` is ptr in C++
> typedef `int&` is ref in C++

That's the inherent difference here, ref is a half-baked type 
constructor in C++ (and porting that behaviour to D would be a 
mistake as it would screw with highly templated code).

But i would agree with you that there is a bug in your initial 
code, the `ref` should be rejected.


More information about the Digitalmars-d mailing list