1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -fsyntax-only -verify %s
2e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman
3e4d2bdd54c29656f2eba004d6db1e4942f2bfcd9Anders Carlssonvoid f(int, ...) __attribute__((sentinel));
4e4d2bdd54c29656f2eba004d6db1e4942f2bfcd9Anders Carlsson
5e4d2bdd54c29656f2eba004d6db1e4942f2bfcd9Anders Carlssonvoid g() {
6e4d2bdd54c29656f2eba004d6db1e4942f2bfcd9Anders Carlsson  f(1, 2, __null);
7e4d2bdd54c29656f2eba004d6db1e4942f2bfcd9Anders Carlsson}
8e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman
9e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedmantypedef __typeof__(sizeof(int)) size_t;
10e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman
11e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedmanstruct S {
12e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman  S(int,...) __attribute__((sentinel)); // expected-note {{marked sentinel}}
13e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman  void a(int,...) __attribute__((sentinel)); // expected-note {{marked sentinel}}
14e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman  void* operator new(size_t,...) __attribute__((sentinel)); // expected-note {{marked sentinel}}
15e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman  void operator()(int,...) __attribute__((sentinel)); // expected-note {{marked sentinel}}
16e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman};
17e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman
18e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedmanvoid class_test() {
19e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman  S s(1,2,3); // expected-warning {{missing sentinel in function call}}
20e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman  S* s2 = new (1,2,3) S(1, __null); // expected-warning {{missing sentinel in function call}}
21e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman  s2->a(1,2,3); // expected-warning {{missing sentinel in function call}}
22e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman  s(1,2,3); // expected-warning {{missing sentinel in function call}}
23e61eb0443a77dd178934d070f458e1a08b84eb96Eli Friedman}
24