aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/conversion/Wwrite-strings.C
blob: f6dbb1506994544f9f4ec160e88e4025306d2065 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// { dg-options "-fdiagnostics-show-caret" }

/* Verify that -Wwrite-strings underlines the string literal in question.  */

extern int callee (const char *one, char *two, const char *three);

int test_1 ()
{
  return callee ("first", "second", "third"); // { dg-warning "string constant to 'char\\*'" }
  /* { dg-begin-multiline-output "" }
   return callee ("first", "second", "third");
                           ^~~~~~~~
     { dg-end-multiline-output "" } */
  // TODO: underline the pertinent param in the decl of callee
}

char *test_2 (void)
{
  return "foo"; // { dg-warning "string constant to 'char\\*'" }
  /* { dg-begin-multiline-output "" }
   return "foo";
          ^~~~~
     { dg-end-multiline-output "" } */
}