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

Message ID 20190514211759.GH18891@redhat.com
State New
Headers show
Series
  • C++ PATCH to add test for c++/68918
Related show

Commit Message

Marek Polacek May 14, 2019, 9:17 p.m.
We used to print errors, but since r236221 this compiles fine.  clang++ also
compiles it without errors.

Tested on x86_64-linux, applying to trunk.

2019-05-14  Marek Polacek  <polacek@redhat.com>

	PR c++/68918
	* g++.dg/cpp0x/decltype71.C: New test.

Patch

diff --git gcc/testsuite/g++.dg/cpp0x/decltype71.C gcc/testsuite/g++.dg/cpp0x/decltype71.C
new file mode 100644
index 00000000000..24c3abfba49
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp0x/decltype71.C
@@ -0,0 +1,25 @@ 
+// PR c++/68918
+// { dg-do compile { target c++11 } }
+
+struct foo {
+    static void a() {}
+
+    auto b() const -> decltype( this->a() )
+    {}
+
+    template<typename X>
+    auto c() -> decltype( this->a() )
+    {}
+
+    template<typename X>
+    auto d() const -> decltype( a() )
+    {}
+
+    template<typename X>
+    auto e() const -> decltype( this->a() )
+    {}
+};
+
+int main()
+{
+}