re PR c++/80691 (Narrowing conversion in {} allowed in a SFINAE context)
2018-05-08 Paolo Carlini <paolo.carlini@oracle.com> PR c++/80691 * g++.dg/cpp0x/narrowing1.C: New. From-SVN: r260027
This commit is contained in:
parent
4be63d9e5e
commit
3e8f909a06
2 changed files with 29 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2018-05-08 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/80691
|
||||
* g++.dg/cpp0x/narrowing1.C: New.
|
||||
|
||||
2018-05-08 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR middle-end/85588
|
||||
|
|
24
gcc/testsuite/g++.dg/cpp0x/narrowing1.C
Normal file
24
gcc/testsuite/g++.dg/cpp0x/narrowing1.C
Normal file
|
@ -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<typename...> using void_t = void;
|
||||
template<typename T> T&& declval();
|
||||
|
||||
template<typename T, typename U, typename = void>
|
||||
struct is_nonnarrowing_conversion : false_type {};
|
||||
|
||||
template<typename T, typename U>
|
||||
struct is_nonnarrowing_conversion<T, U,
|
||||
void_t<decltype(T{ declval<U>() })>> : true_type {};
|
||||
|
||||
template<typename T>
|
||||
class wrapper
|
||||
{
|
||||
public:
|
||||
wrapper(T) {}
|
||||
};
|
||||
|
||||
static_assert(!is_nonnarrowing_conversion<int, float>::value, "");
|
||||
static_assert(!is_nonnarrowing_conversion<wrapper<int>, float>::value, "");
|
Loading…
Add table
Reference in a new issue