aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Sema/warn-unreachable_crash.cpp
blob: 628abcc83f8109d942c7724a8c78b729ec834d97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// RUN: %clang_cc1 -verify -Wunreachable-code %s

// Previously this test will crash
static void test(__fp16& x) {
  if (x != 0 || x != 1.0) { // expected-note{{}} no-crash
      x = 0.9;
    } else
      x = 0.8; // expected-warning{{code will never be executed}}
}

static void test2(__fp16& x) {
  if (x != 1 && x == 1.0) { // expected-note{{}} no-crash
      x = 0.9; // expected-warning{{code will never be executed}}
    } else
      x = 0.8;
}