Welcome to mirror list, hosted at ThFree Co, Russian Federation.

warn_false_to_pointer.cpp « SemaCXX « test « clang - github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 26b54f6e685b3588b5b0940fcfab64b5d5e7d6a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// RUN: %clang_cc1 -fsyntax-only -verify %s

int* j = false; // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}}

void foo(int* i, int *j=(false)) // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}}
{
  foo(false); // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}}
  foo((int*)false);
}

char f(struct Undefined*);
double f(...);

// Ensure that when using false in metaprogramming machinery its conversion
// isn't flagged.
template <int N> struct S {};
S<sizeof(f(false))> s;