Richard Smith | 762bb9d | 2011-10-13 22:29:44 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s |
Sebastian Redl | 5d484e8 | 2009-11-23 17:18:46 +0000 | [diff] [blame] | 2 | |
| 3 | struct s0; // expected-note {{forward declaration}} |
| 4 | char ar[sizeof(s0&)]; // expected-error {{invalid application of 'sizeof' to an incomplete type}} |
| 5 | void test() { |
| 6 | char &r = ar[0]; |
Richard Smith | a0109e2 | 2013-01-29 10:18:18 +0000 | [diff] [blame] | 7 | static_assert(alignof(r) == 1, "bad alignment"); // expected-warning {{GNU extension}} |
| 8 | static_assert(alignof(char&) == 1, "bad alignment"); |
Sebastian Redl | 5d484e8 | 2009-11-23 17:18:46 +0000 | [diff] [blame] | 9 | static_assert(sizeof(r) == 1, "bad size"); |
Richard Smith | a0109e2 | 2013-01-29 10:18:18 +0000 | [diff] [blame] | 10 | static_assert(sizeof(char&) == 1, "bad size"); |
Sebastian Redl | 5d484e8 | 2009-11-23 17:18:46 +0000 | [diff] [blame] | 11 | } |
Douglas Gregor | 9ba6af8 | 2010-05-23 19:43:23 +0000 | [diff] [blame] | 12 | |
John McCall | 6dbba4f | 2011-10-11 23:14:30 +0000 | [diff] [blame] | 13 | void f(); // expected-note{{possible target for call}} |
| 14 | void f(int); // expected-note{{possible target for call}} |
Douglas Gregor | 9ba6af8 | 2010-05-23 19:43:23 +0000 | [diff] [blame] | 15 | void g() { |
Douglas Gregor | ee697e6 | 2011-10-13 18:10:35 +0000 | [diff] [blame] | 16 | sizeof(&f); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} \ |
| 17 | // expected-warning{{expression result unused}} |
Douglas Gregor | 9ba6af8 | 2010-05-23 19:43:23 +0000 | [diff] [blame] | 18 | } |
Douglas Gregor | 4f0845e | 2011-06-22 23:21:00 +0000 | [diff] [blame] | 19 | |
John McCall | 6dbba4f | 2011-10-11 23:14:30 +0000 | [diff] [blame] | 20 | template<typename T> void f_template(); // expected-note{{possible target for call}} |
| 21 | template<typename T> void f_template(T*); // expected-note{{possible target for call}} |
Douglas Gregor | 4f0845e | 2011-06-22 23:21:00 +0000 | [diff] [blame] | 22 | void rdar9659191() { |
Richard Smith | a0109e2 | 2013-01-29 10:18:18 +0000 | [diff] [blame] | 23 | (void)alignof(f_template<int>); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}} expected-warning {{GNU extension}} |
Douglas Gregor | 4f0845e | 2011-06-22 23:21:00 +0000 | [diff] [blame] | 24 | } |