C++17 cannot beat D surely

Ali Çehreli via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 6 20:10:06 PDT 2017


On 06/06/2017 08:06 PM, Ali Çehreli wrote:

 >     enum e = [ 1 ];
 >     static assert(e.ptr != e.ptr);
 > I'm surprised that e.ptr is usable at compile time.

Sorry to notice this late but printing that ptr exposes the copy-paste 
behavior of enums:

     pragma(msg, e.ptr);

Outputs

&[1][0]

That makes sense. It's still interesting that static assert accepts that 
address comparison. I guess it knows that the result is always false.

Ali



More information about the Digitalmars-d mailing list