* [C++ PATCH] PR c++/87093
@ 2018-09-09 22:02 Ville Voutilainen
2018-09-09 23:26 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Ville Voutilainen @ 2018-09-09 22:02 UTC (permalink / raw)
To: gcc-patches List, Jason Merrill
[-- Attachment #1: Type: text/plain, Size: 401 bytes --]
Tested manually on Linux-x64, running full suite on Linux-PPC64. This
seems half-obvious. OK for trunk? Backports?
2018-09-10 Ville Voutilainen <ville.voutilainen@gmail.com>
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.
[-- Attachment #2: pr87093.diff --]
[-- Type: text/x-patch, Size: 1002 bytes --]
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 0b208a8..d75dacb 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<tree, va_gc> *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 0000000..8f25e7e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_constructible2.C
@@ -0,0 +1,12 @@
+// { dg-do compile { target c++11 } }
+
+#include <type_traits>
+
+template <typename T> struct x {
+ operator bool() {
+ static_assert(!std::is_same<T, T>::value, "");
+ return false;
+ }
+};
+
+static constexpr auto a = __is_constructible(bool, x<int>);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [C++ PATCH] PR c++/87093
2018-09-09 22:02 [C++ PATCH] PR c++/87093 Ville Voutilainen
@ 2018-09-09 23:26 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2018-09-09 23:26 UTC (permalink / raw)
To: Ville Voutilainen; +Cc: gcc-patches List
OK for trunk and branches.
On Sun, Sep 9, 2018 at 11:02 PM, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> Tested manually on Linux-x64, running full suite on Linux-PPC64. This
> seems half-obvious. OK for trunk? Backports?
>
> 2018-09-10 Ville Voutilainen <ville.voutilainen@gmail.com>
>
> 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-09 23:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-09 22:02 [C++ PATCH] PR c++/87093 Ville Voutilainen
2018-09-09 23:26 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).