const and immutable values, D vs C++?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Dec 5 10:59:50 UTC 2019


On Thursday, 5 December 2019 at 10:41:24 UTC, Ola Fosheim Grøstad 
wrote:
>     immutable x1 = mk!node1();  //succeeds?
>     immutable y1 = mk_node1();  //fails

Nevermind, seems like templated functions get stronger coercion, 
like:

  immutable y1 = cast(immutable)mk_node1();

(Also no need to explain that immutable(node0) rewrites all the 
pointer types to immutable, I get it :-)



More information about the Digitalmars-d-learn mailing list