* C++ PATCH for c++/67240 (implicit conversion constraint)
@ 2015-08-21 18:34 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2015-08-21 18:34 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 139 bytes --]
perform_direct_initialization_if_possible returns NULL_TREE if no
conversion is possible.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 67240.patch --]
[-- Type: text/x-patch, Size: 1345 bytes --]
commit d25eb4518d272d25dbd63d0d4802102be0a2ca08
Author: Jason Merrill <jason@redhat.com>
Date: Fri Aug 21 12:14:48 2015 -0400
PR c++/67240
* constraint.cc (satisfy_implicit_conversion_constraint): Also
check for NULL_TREE.
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index c981212..cb82535 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -1775,7 +1775,7 @@ satisfy_implicit_conversion_constraint (tree t, tree args,
of the form TYPE <unspecified> = EXPR. */
tree conv =
perform_direct_initialization_if_possible (type, expr, false, complain);
- if (conv == error_mark_node)
+ if (conv == NULL_TREE || conv == error_mark_node)
return boolean_false_node;
else
return boolean_true_node;
diff --git a/gcc/testsuite/g++.dg/concepts/iconv1.C b/gcc/testsuite/g++.dg/concepts/iconv1.C
new file mode 100644
index 0000000..c4dd38f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/iconv1.C
@@ -0,0 +1,20 @@
+// PR c++/67240
+// { dg-options -std=c++1z }
+
+int foo(int x)
+{
+ return x;
+}
+
+template <typename T>
+concept bool C1 = requires (T x) {
+ {foo(x)} -> int&;
+};
+
+template <typename T>
+concept bool C2 = requires (T x) {
+ {foo(x)} -> void;
+};
+
+static_assert( C1<int> ); // { dg-error "assert" }
+static_assert( C2<int> ); // { dg-error "assert" }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-08-21 18:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-21 18:34 C++ PATCH for c++/67240 (implicit conversion constraint) 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).