blob: e1577a3abe37556019ef7a4c23f65c1ef8216ad0 [file] [log] [blame]
Rafael Espindolac4b1aea2013-10-04 14:33:42 +00001// RUN: %clang_cc1 %s -std=c++11 -emit-llvm-only
Nico Weberc1d42ad2015-01-07 18:47:51 +00002// RUN: %clang_cc1 -emit-obj -o %t -gline-tables-only -std=c++11 %s
Rafael Espindolac4b1aea2013-10-04 14:33:42 +00003// CHECK that we don't crash.
4
5// PR11676's example is ill-formed:
6/*
7union _XEvent {
8};
9void ProcessEvent() {
10 _XEvent pluginEvent = _XEvent();
11}
12*/
13
14// Example from PR11665:
15void f() {
16 union U { int field; } u = U();
17 (void)U().field;
18}
19
20namespace PR17476 {
21struct string {
22 string(const char *__s);
23 string &operator+=(const string &__str);
24};
25
26template <class ELFT> void finalizeDefaultAtomValues() {
27 auto startEnd = [&](const char * sym)->void {
28 string start("__");
29 start += sym;
30 }
31 ;
32 startEnd("preinit_array");
33}
34
35void f() { finalizeDefaultAtomValues<int>(); }
36}
Nico Webereac50032015-01-07 18:23:08 +000037
38namespace PR22096 {
Nico Weberc1d42ad2015-01-07 18:47:51 +000039template <class> struct c {
40 c();
41 template <class U> __attribute__((__always_inline__)) c(c<U>) {}
Nico Webereac50032015-01-07 18:23:08 +000042};
Nico Weberc1d42ad2015-01-07 18:47:51 +000043struct {
44 c<double> v = c<int>();
45} o;
Nico Webereac50032015-01-07 18:23:08 +000046}