[Bug c++/80691] Narrowing conversion in {} allowed in a SFINAE context

2018-05-08 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80691

Paolo Carlini  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |8.0

--- Comment #6 from Paolo Carlini  ---
Fixed in 8.1.0.

[Bug c++/80691] Narrowing conversion in {} allowed in a SFINAE context

2018-05-08 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80691

--- Comment #5 from paolo at gcc dot gnu.org  ---
Author: paolo
Date: Tue May  8 08:55:30 2018
New Revision: 260027

URL: https://gcc.gnu.org/viewcvs?rev=260027=gcc=rev
Log:
2018-05-08  Paolo Carlini  

PR c++/80691
* g++.dg/cpp0x/narrowing1.C: New.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/narrowing1.C
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug c++/80691] Narrowing conversion in {} allowed in a SFINAE context

2017-06-01 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80691

--- Comment #4 from Jonathan Wakely  ---
N.B. Bug 78244 is similar, and not restricted to C++17.

[Bug c++/80691] Narrowing conversion in {} allowed in a SFINAE context

2017-05-09 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80691

--- Comment #3 from Jonathan Wakely  ---
Standalone testcase that compiles as C++11 or C++14, fails as C++17:

struct true_type { static constexpr bool value = true; };
struct false_type { static constexpr bool value = false; };
template using void_t = void;
template T&& declval();

template
struct is_nonnarrowing_conversion : false_type {};

template
struct is_nonnarrowing_conversion> : true_type {};

template
class wrapper
{
public:
wrapper(T) {}
};

static_assert(!is_nonnarrowing_conversion::value, "");
static_assert(!is_nonnarrowing_conversion::value, "");

[Bug c++/80691] Narrowing conversion in {} allowed in a SFINAE context

2017-05-09 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80691

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-05-09
 Ever confirmed|0   |1

--- Comment #2 from Jonathan Wakely  ---
This only happens in C++17 mode. With -std=gnu++14 it compiles OK, and also
with -std=c++14 if you make it C++14-compatible:

#include 
#include 

template using void_t = void;

template
struct is_nonnarrowing_conversion : std::false_type {};

template
struct is_nonnarrowing_conversion> : std::true_type {};

template
class wrapper
{
public:
wrapper(T) {}
};

static_assert(!is_nonnarrowing_conversion(), "");
static_assert(!is_nonnarrowing_conversion(), "");

[Bug c++/80691] Narrowing conversion in {} allowed in a SFINAE context

2017-05-09 Thread griwes at griwes dot info
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80691

--- Comment #1 from MichaƂ Dominiak  ---
This bug makes it seem (in SFINAE contexts) that std::string is constructible
from double with an initializer-list constructor, without narrowing:

#include 
#include 

using std::void_t;

template
struct is_nonnarrowing_conversion : std::false_type {};

template
struct is_nonnarrowing_conversion> : std::true_type {};

static_assert(!is_nonnarrowing_conversion());