Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/warn/Wformat-2.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 // PR c++/84076 | |
2 // { dg-do compile } | |
3 // { dg-options "-Wformat" } | |
4 | |
5 struct S { ~S (); }; | |
6 struct T { T (); T (const T &); }; | |
7 | |
8 void | |
9 foo () | |
10 { | |
11 S s; | |
12 T t; | |
13 __builtin_printf ("%s\n", s); // { dg-warning "format '%s' expects argument of type 'char\\*', but argument 2 has type 'S'" } | |
14 __builtin_printf ("%s\n", t); // { dg-warning "format '%s' expects argument of type 'char\\*', but argument 2 has type 'T'" } | |
15 __builtin_printf ("%s\n", &s);// { dg-warning "format '%s' expects argument of type 'char\\*', but argument 2 has type 'S\\*'" } | |
16 __builtin_printf ("%s\n", &t);// { dg-warning "format '%s' expects argument of type 'char\\*', but argument 2 has type 'T\\*'" } | |
17 } |