aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix.C
blob: b9b975b5dc2f9894ae34fbe82b8088e9904d58ac (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
25
26
27
28
// { dg-do run { target c++11 } }

// Make sure -Wliteral-suffix is enabled by default and
// triggers as expected.

#define BAR "bar"
#define PLUS_ONE + 1

#include <cstdint>
#include <cassert>


void
test()
{
  char c = '3'PLUS_ONE;	  // { dg-warning "invalid suffix on literal" }
  char s[] = "foo"BAR;	  // { dg-warning "invalid suffix on literal" }

  assert(c == '4');
  assert(s[3] != '\0');
  assert(s[3] == 'b');
}

int
main()
{
  test();
}