2018-10-23 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / spellcheck-identifiers-2.C
blob59a8ec55c61e6c9dd02c72dcdea23f85ad06c3c9
1 /* PR c/71858 */
2 /* Make sure anticipated builtins are not considered before they are declared.  */
3 /* { dg-do compile } */
4 /* { dg-options "-fdiagnostics-show-caret" } */
6 int sscafn (const char *, const char *, ...);
8 int
9 test_1 (const char *p)
11   int i;
12   return ssacnf (p, "%d", &i); /* { dg-error "10: .ssacnf. was not declared in this scope" } */
13   /* { dg-begin-multiline-output "" }
14    return ssacnf (p, "%d", &i);
15           ^~~~~~
16    { dg-end-multiline-output "" } */
17   // { dg-message "10: suggested alternative: 'sscafn'" "" { target *-*-* } 12 }
18   /* { dg-begin-multiline-output "" }
19    return ssacnf (p, "%d", &i);
20           ^~~~~~
21           sscafn
22    { dg-end-multiline-output "" } */
25 int scafn (const char *, ...);
26 int scanf (const char *, ...);
28 int
29 test_2 (void)
31   int i;
32   return sacnf ("%d", &i); /* { dg-error "10: .sacnf. was not declared in this scope" } */
33   /* { dg-begin-multiline-output "" }
34    return sacnf ("%d", &i);
35           ^~~~~
36    { dg-end-multiline-output "" } */
37   // { dg-message "10: suggested alternative: 'scanf'" "" { target *-*-* } 32 }
38   /* { dg-begin-multiline-output "" }
39    return sacnf ("%d", &i);
40           ^~~~~
41           scanf
42    { dg-end-multiline-output "" } */