view gcc/testsuite/g++.dg/warn/Wformat-ranges-c++11.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line source

// { dg-do compile { target c++11 } }
// { dg-skip-if "char8_t" { c++2a } }
/* { dg-options "-Wformat -fdiagnostics-show-caret" } */

/* C++11-specific format tests. */

#define printf __builtin_printf

void test_u8 (const char *msg)
{
  printf(u8"hello %i", msg);/* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char\\*' " } */
/* { dg-begin-multiline-output "" }
   printf(u8"hello %i", msg);
                   ~^   ~~~
                    |   |
                    int const char*
                   %s
   { dg-end-multiline-output "" } */
}