diff mbox series

C++ PATCH to add test for c++/89356

Message ID 20190217175709.GI3884@redhat.com
State New
Headers show
Series C++ PATCH to add test for c++/89356 | expand

Commit Message

Marek Polacek Feb. 17, 2019, 5:57 p.m. UTC
Also fixed by r268969.  There was a sorry, because IMPLICIT_CONV_EXPR
got to write_expression.  I also noticed a change in how we mangle
a decltype with a brace-init-list, so I've added a test for that too.

Tested on x86_64-linux, applying to trunk.

2019-02-17  Marek Polacek  <polacek@redhat.com>

	PR c++/89356
	* g++.dg/abi/mangle68.C: New test.
	* g++.dg/cpp0x/decltype69.C: New test.
diff mbox series

Patch

diff --git gcc/testsuite/g++.dg/abi/mangle68.C gcc/testsuite/g++.dg/abi/mangle68.C
new file mode 100644
index 00000000000..3e16eeb62d0
--- /dev/null
+++ gcc/testsuite/g++.dg/abi/mangle68.C
@@ -0,0 +1,8 @@ 
+// PR c++/89356
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+auto fn () -> decltype(unsigned{2u} + (T)3) { return 42; }
+
+// { dg-final { scan-assembler "_Z2fnIiEDTpltljLj2EEcvT_Li3EEv" } }
+template auto fn<int>() -> decltype(unsigned{2u} + (int)3);
diff --git gcc/testsuite/g++.dg/cpp0x/decltype69.C gcc/testsuite/g++.dg/cpp0x/decltype69.C
new file mode 100644
index 00000000000..849a2446965
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp0x/decltype69.C
@@ -0,0 +1,10 @@ 
+// PR c++/89356
+// { dg-do compile { target c++11 } }
+
+typedef unsigned a;
+template <typename> struct h {};
+template <int, class b> auto c(b f) -> h<decltype(f(a{0}))>;
+typedef char byte;
+enum d : byte;
+d g(byte);
+h<d> e = c<6>(g);