re PR c++/79457 (Segmentation fault in templated decltype evaluation)
authorJakub Jelinek <jakub@redhat.com>
Fri, 10 Feb 2017 20:58:31 +0000 (21:58 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 10 Feb 2017 20:58:31 +0000 (21:58 +0100)
PR c++/79457
* g++.dg/cpp0x/pr79457.C: New test.

From-SVN: r245344

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

index a143d7c4443e001f85af057e5626486cde9414ce..7a5abd8a3337dfbd52cd6e9a08207b9e93b65f0b 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/79457
+       * g++.dg/cpp0x/pr79457.C: New test.
+
 2017-02-10  Segher Boessenkool  <segher@kernel.crashing.org>
 
        * gcc.target/powerpc/fold-vec-mult-longlong.c: Don't do the
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr79457.C b/gcc/testsuite/g++.dg/cpp0x/pr79457.C
new file mode 100644 (file)
index 0000000..937e0e0
--- /dev/null
@@ -0,0 +1,24 @@
+// PR c++/79457
+// { dg-do compile { target c++11 } }
+
+template <typename T>
+class Foo
+{
+private:
+  T& goo;
+  template <typename R>
+  using S = decltype (goo[R ()]);
+
+public:
+  Foo (T& goo) : goo {goo} {}
+
+  template <typename R>
+  S<R> boo () {}
+};
+
+int
+main ()
+{
+  int bar[] = {1, 2, 3};
+  Foo<decltype (bar)> foo {bar};
+}