C++ Logo


Advanced search

Re: P0608 seems to have unintended consequences - variant vs overload resolution

From: Tjernstrom, Staffan <Staffan.Tjernstrom_at_[hidden]>
Date: Wed, 12 Jun 2019 17:17:45 +0000
C&P error. Should have read

Now, with P0608 in place, we have conflicting behaviour, but the variant case is "sane".
int func( string )
   return 42;

int func( bool )
   return 19;

int x = func( "Hello" ); // x is 42
int y= func( "Hello"s ); // x is 42

std::variant< bool, string > z;
z = "Hello World"; // z holds a string


IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

Received on 2019-06-12 12:19:34