re PR c++/80873 (ICE in tsubst_copy when trying to use an overloaded function without...
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 13 Oct 2017 16:50:13 +0000 (16:50 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 13 Oct 2017 16:50:13 +0000 (16:50 +0000)
2017-10-13  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/80873
* g++.dg/cpp1y/auto-fn41.C: New.
* g++.dg/cpp1y/auto-fn42.C: Likewise.

From-SVN: r253733

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/auto-fn41.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/auto-fn42.C [new file with mode: 0644]

index 6bb877ea3873ecb376020fc6c6d1eb4aae7ef3ee..f3dbf5d9286a2a3fa6ee44aea29ac47d4cdaa54f 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-13  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/80873
+       * g++.dg/cpp1y/auto-fn41.C: New.
+       * g++.dg/cpp1y/auto-fn42.C: Likewise.
+
 2017-10-13  David Malcolm  <dmalcolm@redhat.com>
 
        * g++.dg/cpp0x/udlit-extern-c.C: New test case.
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn41.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn41.C
new file mode 100644 (file)
index 0000000..25a879d
--- /dev/null
@@ -0,0 +1,23 @@
+// PR c++/80873
+// { dg-do compile { target c++14 } }
+
+struct S {};
+
+auto overloaded(S &);
+
+template <typename T>
+int overloaded(T &) {
+    return 0;
+}
+
+template <typename T>
+auto returns_lambda(T &param) {
+       return [&] {
+               overloaded(param);  // { dg-error "before deduction" }
+       };
+}
+
+int main() {
+       S s;
+       returns_lambda(s);
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn42.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn42.C
new file mode 100644 (file)
index 0000000..0f2b68e
--- /dev/null
@@ -0,0 +1,21 @@
+// PR c++/80873
+// { dg-do compile { target c++14 } }
+
+struct Buffer {};
+
+auto parse(Buffer b);
+template <typename T> void parse(T target);
+
+template <typename T>
+auto field(T target) {
+       return [&] {
+               parse(target);
+       };
+}
+
+template <typename T>
+void parse(T target) {}
+
+auto parse(Buffer b) {
+       field(0);
+}