summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/expressions.cpp
blob: c4e9dccbf62161a672a61aeca582b44897554384 (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
29
30
31
32
33
34
// RUN: %clang_cc1 -fsyntax-only -verify %s 

void choice(int);
int choice(bool);

void test() {
  // Result of ! must be type bool.
  int i = choice(!1);
}

// rdar://8018252
void f0() {
  extern void f0_1(int*);
  register int x;
  f0_1(&x);
}

namespace test1 {
  template <class T> void bar(T &x) { T::fail(); }
  template <class T> void bar(volatile T &x) {}

  void test_ints() {
    volatile int x;
    bar(x = 5);
    bar(x += 5);
  }

  enum E { E_zero };
  void test_enums() {
    volatile E x;
    bar(x = E_zero);
    bar(x += E_zero); // expected-error {{incompatible type}}
  }
}
OpenPOWER on IntegriCloud