aboutsummaryrefslogtreecommitdiff
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/missing-typename.C12
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C25
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/pr86993.C13
3 files changed, 45 insertions, 5 deletions
diff --git a/gcc/testsuite/g++.dg/diagnostic/missing-typename.C b/gcc/testsuite/g++.dg/diagnostic/missing-typename.C
new file mode 100644
index 00000000000..21d1ed18a60
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/missing-typename.C
@@ -0,0 +1,12 @@
+// fix-it hint for missing "typename" (PR c++/63392)
+// { dg-options "-fdiagnostics-show-caret" }
+
+template<typename T>
+class test_1 {
+ T::type x; // { dg-error "need 'typename' before 'T::type' because 'T' is a dependent scope" }
+ /* { dg-begin-multiline-output "" }
+ T::type x;
+ ^
+ typename
+ { dg-end-multiline-output "" } */
+};
diff --git a/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C b/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C
index 8cf2dabca64..4957f61878e 100644
--- a/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C
+++ b/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C
@@ -82,7 +82,10 @@ int test_4 (int first, const char *second, float third)
^~~~~~~~
{ dg-end-multiline-output "" } */
// { dg-message "no known conversion for argument 2 from 'const char\\*' to 'const char\\*\\*'" "" { target *-*-* } s4_member_1 }
- // TODO: underline the pertinent param
+ /* { dg-begin-multiline-output "" }
+ struct s4 { static int member_1 (int one, const char **two, float three); };
+ ~~~~~~~~~~~~~^~~
+ { dg-end-multiline-output "" } */
}
/* non-static member, with argname. */
@@ -103,7 +106,10 @@ int test_5 (int first, const char *second, float third)
^~~~~~~~
{ dg-end-multiline-output "" } */
// { dg-message "no known conversion for argument 2 from 'const char\\*' to 'const char\\*\\*'" "" { target *-*-* } s5_member_1 }
- // TODO: underline the pertinent param
+ /* { dg-begin-multiline-output "" }
+ struct s5 { int member_1 (int one, const char **two, float three); };
+ ~~~~~~~~~~~~~^~~
+ { dg-end-multiline-output "" } */
}
/* non-static member, with argname, via a ptr. */
@@ -123,7 +129,10 @@ int test_6 (int first, const char *second, float third, s6 *ptr)
^~~~~~~~
{ dg-end-multiline-output "" } */
// { dg-message "no known conversion for argument 2 from 'const char\\*' to 'const char\\*\\*'" "" { target *-*-* } s6_member_1 }
- // TODO: underline the pertinent param
+ /* { dg-begin-multiline-output "" }
+ struct s6 { int member_1 (int one, const char **two, float three); };
+ ~~~~~~~~~~~~~^~~
+ { dg-end-multiline-output "" } */
}
/* Template function. */
@@ -170,7 +179,10 @@ int test_8 (int first, const char *second, float third)
^~~~~~~~
{ dg-end-multiline-output "" } */
// { dg-message "no known conversion for argument 2 from 'const char\\*' to 'const char\\*\\*'" "" { target *-*-* } s8_member_1 }
- // TODO: underline the pertinent param
+ /* { dg-begin-multiline-output "" }
+ struct s8 { static int member_1 (int one, T two, float three); };
+ ~~^~~
+ { dg-end-multiline-output "" } */
}
/* Template class, non-static function. */
@@ -192,5 +204,8 @@ int test_9 (int first, const char *second, float third)
^~~~~~~~
{ dg-end-multiline-output "" } */
// { dg-message "no known conversion for argument 2 from 'const char\\*' to 'const char\\*\\*'" "" { target *-*-* } s9_member_1 }
- // TODO: underline the pertinent param
+ /* { dg-begin-multiline-output "" }
+ struct s9 { int member_1 (int one, T two, float three); };
+ ~~^~~
+ { dg-end-multiline-output "" } */
}
diff --git a/gcc/testsuite/g++.dg/diagnostic/pr86993.C b/gcc/testsuite/g++.dg/diagnostic/pr86993.C
new file mode 100644
index 00000000000..313a489ae86
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/pr86993.C
@@ -0,0 +1,13 @@
+// PR c++/86993
+// { dg-options "-fdiagnostics-show-caret" }
+
+int
+main ()
+{
+ const int i = 5; // { dg-error "assignment of read-only variable 'i'" "" { target *-*-* } .+1 }
+ i = 5 + 6;
+/* { dg-begin-multiline-output "" }
+ i = 5 + 6;
+ ~~^~~~~~~
+ { dg-end-multiline-output "" } */
+}