From 3e8f909a069d36528b4cfd404db8d857f9a9d95b Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 8 May 2018 08:55:30 +0000 Subject: [PATCH] re PR c++/80691 (Narrowing conversion in {} allowed in a SFINAE context) 2018-05-08 Paolo Carlini PR c++/80691 * g++.dg/cpp0x/narrowing1.C: New. From-SVN: r260027 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/narrowing1.C | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/narrowing1.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 795af52dcdc..000dc689f53 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-05-08 Paolo Carlini + + PR c++/80691 + * g++.dg/cpp0x/narrowing1.C: New. + 2018-05-08 Richard Biener PR middle-end/85588 diff --git a/gcc/testsuite/g++.dg/cpp0x/narrowing1.C b/gcc/testsuite/g++.dg/cpp0x/narrowing1.C new file mode 100644 index 00000000000..ba4bb4e9f0d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/narrowing1.C @@ -0,0 +1,24 @@ +// PR c++/80691 +// { dg-do compile { target c++11 } } + +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, float>::value, ""); -- 2.30.2