[C++] Add test for c++/77747

Message ID 20190608004759.GT5989@redhat.com
State New
Headers show
Series
  • [C++] Add test for c++/77747
Related show

Commit Message

Marek Polacek June 8, 2019, 12:47 a.m.
This was fixed by r241765 but we didn't have an explicit test that tests if we
detect the error of inheriting constructors from an indirect base.

Tested on x86_64-linux, applying to trunk.

2019-06-07  Marek Polacek  <polacek@redhat.com>

	PR c++/77747
	* g++.dg/cpp0x/inh-ctor33.C: New test.

Patch

diff --git gcc/testsuite/g++.dg/cpp0x/inh-ctor33.C gcc/testsuite/g++.dg/cpp0x/inh-ctor33.C
new file mode 100644
index 00000000000..95b7812f054
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp0x/inh-ctor33.C
@@ -0,0 +1,19 @@ 
+// PR c++/77747
+// { dg-do compile { target c++11 } }
+
+class X {
+public:
+  X() { }
+  X(int a) { }
+};
+
+class Y : public X { };
+
+class Z : public Y {
+  using X::X; // { dg-error "cannot inherit constructors from indirect base .X." }
+};
+
+int main()
+{
+  Z z{3}; // { dg-error "no matching" }
+}