From b51da998eee6b17630d7c9b1035cf47b77aa2af3 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Thu, 13 Sep 2018 00:10:43 +0300 Subject: [PATCH] re PR c++/87093 (is_constructible (__is_constructible() instrinsic) explicitly instantiates conversion member function of source) PR c++/87093 gcc/cp PR c++/87093 * method.c (constructible_expr): We're in an unevaluated context in all cases, not just for class targets. testsuite/ PR c++/87093 * g++.dg/ext/is_constructible2.C: New. From-SVN: r264253 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/method.c | 2 +- gcc/testsuite/g++.dg/ext/is_constructible2.C | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ext/is_constructible2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9201d67c0ab..ca8939d9a08 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-09-13 Ville Voutilainen + + PR c++/87093 + * method.c (constructible_expr): We're in an unevaluated context + in all cases, not just for class targets. + 2018-09-12 David Malcolm PR c++/85110 diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 0b208a8d52a..d75dacb1373 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1144,11 +1144,11 @@ static tree constructible_expr (tree to, tree from) { tree expr; + cp_unevaluated cp_uneval_guard; if (CLASS_TYPE_P (to)) { tree ctype = to; vec *args = NULL; - cp_unevaluated cp_uneval_guard; if (!TYPE_REF_P (to)) to = cp_build_reference_type (to, /*rval*/false); tree ob = build_stub_object (to); diff --git a/gcc/testsuite/g++.dg/ext/is_constructible2.C b/gcc/testsuite/g++.dg/ext/is_constructible2.C new file mode 100644 index 00000000000..8f25e7e27d2 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/is_constructible2.C @@ -0,0 +1,12 @@ +// { dg-do compile { target c++11 } } + +#include + +template struct x { + operator bool() { + static_assert(!std::is_same::value, ""); + return false; + } +}; + +static constexpr auto a = __is_constructible(bool, x); -- 2.30.2