aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-02-22 10:55:32 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-02-22 10:55:32 +0100
commit25c1b6cb3457e5c09793f2bb8c700e8230626975 (patch)
tree1f541e924c2b90555dcf2541dfe04dd002a8199f
parent3f5fabc0eab4b2145d7f4fd7cf310b9b5bf022ed (diff)
downloadgcc-25c1b6cb3457e5c09793f2bb8c700e8230626975.zip
gcc-25c1b6cb3457e5c09793f2bb8c700e8230626975.tar.gz
gcc-25c1b6cb3457e5c09793f2bb8c700e8230626975.tar.bz2
re PR c++/84496 (Internal compiler error with lambda, static and auto since r236615)
PR c++/84496 * g++.dg/cpp1y/pr84496.C: New test. From-SVN: r257895
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr84496.C44
2 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 681971b..161d523 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2018-02-22 Jakub Jelinek <jakub@redhat.com>
+ PR c++/84496
+ * g++.dg/cpp1y/pr84496.C: New test.
+
PR target/84502
* g++.dg/torture/pr84502.C: New test.
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr84496.C b/gcc/testsuite/g++.dg/cpp1y/pr84496.C
new file mode 100644
index 0000000..028d002
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr84496.C
@@ -0,0 +1,44 @@
+// PR c++/84496
+// { dg-do compile { target c++14 } }
+
+template <typename T, T n> struct C { static constexpr T D = n; };
+struct E : C<bool, false> {};
+template <typename> struct F : C<bool, false> {};
+template <typename T> T foo ();
+template <typename> struct H { typedef int G; };
+template <typename> class I;
+struct L;
+template <typename, typename> struct J;
+template <bool, bool, typename...> struct K;
+struct R {
+ template <typename M, typename... N>
+ static J<decltype (foo<M> () (foo<N>...)), L> o;
+};
+template <typename P, typename... Q> struct K<false, false, P, Q...> : R {
+ typedef decltype (o<P, Q...>) G;
+};
+template <typename P, typename... Q>
+struct D : K<E::D, F<typename H<P>::G>::D, P, Q...> {};
+template <typename P, typename... Q> struct I<P (Q...)> : D<P, Q...> {};
+template <typename> class function;
+template <typename S, typename... Q> struct function<S (Q...)> {
+ template <typename T, typename = typename I<T (Q...)>::G> struct C;
+ template <typename, typename> using U = int;
+ template <typename P, typename = U<int, void>, typename = U<C<P>, void>>
+ function (P);
+};
+template <typename S, typename... Q>
+template <typename P, typename, typename>
+function<S (Q...)>::function (P)
+{
+}
+void bar (function<void (int)>);
+
+void
+baz ()
+{
+ auto a = [] {
+ static int counter;
+ bar ([] (auto) { counter++; });
+ };
+}