summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/Wmissing-declarations-1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/Wmissing-declarations-1.C')
-rw-r--r--gcc/testsuite/g++.dg/warn/Wmissing-declarations-1.C45
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Wmissing-declarations-1.C b/gcc/testsuite/g++.dg/warn/Wmissing-declarations-1.C
new file mode 100644
index 000000000..894432519
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wmissing-declarations-1.C
@@ -0,0 +1,45 @@
+// { dg-options "-Wmissing-declarations" }
+
+void fn1() { } // { dg-warning "no previous declaration" }
+namespace ns {
+ void fn2() { } // { dg-warning "no previous declaration" }
+}
+namespace {
+ void fn3() { }
+}
+static void fn4() { }
+
+void fn5();
+namespace ns {
+ void fn6();
+}
+
+void fn5() { }
+namespace ns {
+ void fn6() { }
+}
+
+inline void fn7() { }
+
+class c {
+ void cfn1() { }
+ static void cfn2() { }
+ void cfn3();
+ static void cfn4();
+};
+
+void c::cfn3() { }
+void c::cfn4() { }
+
+static struct {
+ void sfn1() { }
+ static void sfn2() { }
+} s;
+
+template<typename C>
+void tfn1() { }
+
+template void tfn1<c>();
+
+class d { };
+template<> void tfn1<d>() { }