Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Eli Friedman | e61eb04 | 2012-02-18 04:48:30 +0000 | [diff] [blame] | 2 | |
Anders Carlsson | e4d2bdd | 2009-11-24 17:24:21 +0000 | [diff] [blame] | 3 | void f(int, ...) __attribute__((sentinel)); |
| 4 | |
| 5 | void g() { |
| 6 | f(1, 2, __null); |
| 7 | } |
Eli Friedman | e61eb04 | 2012-02-18 04:48:30 +0000 | [diff] [blame] | 8 | |
| 9 | typedef __typeof__(sizeof(int)) size_t; |
| 10 | |
| 11 | struct S { |
| 12 | S(int,...) __attribute__((sentinel)); // expected-note {{marked sentinel}} |
| 13 | void a(int,...) __attribute__((sentinel)); // expected-note {{marked sentinel}} |
| 14 | void* operator new(size_t,...) __attribute__((sentinel)); // expected-note {{marked sentinel}} |
| 15 | void operator()(int,...) __attribute__((sentinel)); // expected-note {{marked sentinel}} |
| 16 | }; |
| 17 | |
| 18 | void class_test() { |
| 19 | S s(1,2,3); // expected-warning {{missing sentinel in function call}} |
| 20 | S* s2 = new (1,2,3) S(1, __null); // expected-warning {{missing sentinel in function call}} |
| 21 | s2->a(1,2,3); // expected-warning {{missing sentinel in function call}} |
| 22 | s(1,2,3); // expected-warning {{missing sentinel in function call}} |
| 23 | } |