blob: 60c2deed4d347345ca9e96605056a8c1733f433b [file] [log] [blame]
Richard Smith9f7df0c2017-06-26 23:19:32 +00001// RUN: %clang_cc1 -std=c++1z -verify %s
2
3namespace pr32864_0 {
4 struct transfer_t {
5 void *fctx;
6 };
7 template <typename Ctx> class record {
8 void run() {
9 transfer_t t;
10 Ctx from{t.fctx};
11 }
12 };
13}
14
15namespace pr33140_0a {
16 struct S {
17 constexpr S(const int &a = 0) {}
18 };
19 void foo(void) { S s[2] = {}; }
20}
21
22namespace pr33140_0b {
23 bool bar(float const &f = 0);
24 bool foo() { return bar() && bar(); }
25}
26
27namespace pr33140_2 {
28 // FIXME: The declaration of 'b' below should lifetime-extend two int
Richard Smithd87aab92018-07-17 22:24:09 +000029 // temporaries.
Richard Smithafe48f92018-07-23 21:21:22 +000030 struct A { int &&r = 0; }; // expected-note 2{{initializing field 'r' with default member initializer}}
Richard Smith9f7df0c2017-06-26 23:19:32 +000031 struct B { A x, y; };
Richard Smithafe48f92018-07-23 21:21:22 +000032 B b = {}; // expected-warning 2{{not supported}}
Richard Smith9f7df0c2017-06-26 23:19:32 +000033}
34
35namespace pr33140_3 {
36 typedef struct Y { unsigned int c; } Y_t;
37 struct X {
38 Y_t a;
39 };
40 struct X foo[2] = {[0 ... 1] = {.a = (Y_t){.c = 0}}};
41}
42
43namespace pr33140_6 {
44 struct Y { unsigned int c; };
45 struct X { struct Y *p; };
46 int f() {
47 // FIXME: This causes clang to crash.
48 //return (struct X[2]){ [0 ... 1] = { .p = &(struct Y&)(struct Y&&)(struct Y){0} } }[0].p->c;
49 return 0;
50 }
51}
52
53namespace pr33140_10 {
54 int a(const int &n = 0);
55 bool b() { return a() == a(); }
56}