Debian Codegraph @

gcc/testsuite/g++.dg/conversion/Wwrite-strings.C

raw
1 // { dg-options "-fdiagnostics-show-caret" }
2
3 /* Verify that -Wwrite-strings underlines the string literal in question. */
4
5 extern int callee (const char *one, char *two, const char *three);
6
7 int test_1 ()
8 {
9 return callee ("first", "second", "third"); // { dg-warning "string constant to 'char\\*'" }
10 /* { dg-begin-multiline-output "" }
11 return callee ("first", "second", "third");
12 ^~~~~~~~
13 { dg-end-multiline-output "" } */
14 // TODO: underline the pertinent param in the decl of callee
15 }
16
17 char *test_2 (void)
18 {
19 return "foo"; // { dg-warning "string constant to 'char\\*'" }
20 /* { dg-begin-multiline-output "" }
21 return "foo";
22 ^~~~~
23 { dg-end-multiline-output "" } */
24 }