summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/diagnostic
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/diagnostic')
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/method1.C20
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/parm1.C11
2 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/diagnostic/method1.C b/gcc/testsuite/g++.dg/diagnostic/method1.C
new file mode 100644
index 00000000000..8e1225d0722
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/method1.C
@@ -0,0 +1,20 @@
+// PR c++/44627
+// { dg-do compile }
+
+struct A
+{
+ A *foo ();
+};
+
+template <class T>
+void
+bar ()
+{
+ A::foo ().anything; // { dg-error "request for member" }
+}
+
+void
+baz ()
+{
+ bar <int> ();
+}
diff --git a/gcc/testsuite/g++.dg/diagnostic/parm1.C b/gcc/testsuite/g++.dg/diagnostic/parm1.C
new file mode 100644
index 00000000000..2e553e2d4c5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/parm1.C
@@ -0,0 +1,11 @@
+// PR c++/44366
+// While printing the operand of sizeof We were trying to print f as the
+// scope of t, causing infinite recursion.
+
+template <typename T>
+void f(T t, int(*)[sizeof(t)])
+{
+ struct A { void g() {
+ foo; // { dg-error "foo" }
+ } };
+}