blob: d76fcf55c2d85420582b635f42073dc6b2d68bf9 [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
Sebastian Redl5d484e82009-11-23 17:18:46 +00002
3struct s0; // expected-note {{forward declaration}}
4char ar[sizeof(s0&)]; // expected-error {{invalid application of 'sizeof' to an incomplete type}}
5void test() {
6 char &r = ar[0];
Richard Smitha0109e22013-01-29 10:18:18 +00007 static_assert(alignof(r) == 1, "bad alignment"); // expected-warning {{GNU extension}}
8 static_assert(alignof(char&) == 1, "bad alignment");
Sebastian Redl5d484e82009-11-23 17:18:46 +00009 static_assert(sizeof(r) == 1, "bad size");
Richard Smitha0109e22013-01-29 10:18:18 +000010 static_assert(sizeof(char&) == 1, "bad size");
Sebastian Redl5d484e82009-11-23 17:18:46 +000011}
Douglas Gregor9ba6af82010-05-23 19:43:23 +000012
John McCall6dbba4f2011-10-11 23:14:30 +000013void f(); // expected-note{{possible target for call}}
14void f(int); // expected-note{{possible target for call}}
Douglas Gregor9ba6af82010-05-23 19:43:23 +000015void g() {
Douglas Gregoree697e62011-10-13 18:10:35 +000016 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 Gregor9ba6af82010-05-23 19:43:23 +000018}
Douglas Gregor4f0845e2011-06-22 23:21:00 +000019
John McCall6dbba4f2011-10-11 23:14:30 +000020template<typename T> void f_template(); // expected-note{{possible target for call}}
21template<typename T> void f_template(T*); // expected-note{{possible target for call}}
Douglas Gregor4f0845e2011-06-22 23:21:00 +000022void rdar9659191() {
Richard Smitha0109e22013-01-29 10:18:18 +000023 (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 Gregor4f0845e2011-06-22 23:21:00 +000024}