re PR c++/79488 (ICE from lambda that has invalid return type)
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 28 Sep 2017 21:18:36 +0000 (21:18 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 28 Sep 2017 21:18:36 +0000 (21:18 +0000)
2017-09-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/79488
* g++.dg/cpp0x/lambda/lambda-ice22.C: New.

From-SVN: r253270

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice22.C [new file with mode: 0644]

index 0bc6fd4aeddf3c702bf99be127b10708b5451d58..bc9b1a365b05eb4be40c45f3054c658bfa73bdbb 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-28  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/79488
+       * g++.dg/cpp0x/lambda/lambda-ice22.C: New.
+
 2017-09-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/82342
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice22.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice22.C
new file mode 100644 (file)
index 0000000..6f2650d
--- /dev/null
@@ -0,0 +1,25 @@
+// PR c++/79488
+// { dg-do compile { target c++11 } }
+
+int f();
+static int g __attribute__((__weakref__("f")));
+
+template <typename Fn> struct res {
+  static Fn val();
+  using type = decltype(val()()); // { dg-error "no match for call" }
+};
+
+template <typename Fn> struct A {
+  template <typename T> void set_result(T) {}
+
+  virtual void run() {
+    auto boundfn = []() -> typename res<Fn>::type{};
+    set_result(boundfn);
+  }
+};
+
+struct F {
+  void operator()() &;
+};
+
+A<F> t;