Clang Project

clang_source_code/test/PCH/cxx11-inheriting-ctors.cpp
1// RUN: %clang_cc1 -std=c++11 -include %s -include %s -verify %s
2//
3// Emit with definitions in the declaration:
4// RxN: %clang_cc1 -std=c++11 -emit-pch -o %t.12 -include %s %s
5// RxN: %clang_cc1 -std=c++11 -include-pch %t.12 -verify %s
6//
7// Emit with definitions in update records:
8// RxN: %clang_cc1 -std=c++11 -emit-pch -o %t.1 %s
9// RxN: %clang_cc1 -std=c++11 -include-pch %t.1 -emit-pch -o %t.2 -verify %s
10// RxN: %clang_cc1 -std=c++11 -include-pch %t.1 -include-pch %t.2 -verify %s
11
12
13// expected-no-diagnostics
14
15#ifndef HEADER1
16#define HEADER1
17
18struct Base {
19  Base(int) {}
20
21  template <typename T>
22  Base(T) {}
23};
24
25struct Test : Base {
26  using Base::Base;
27};
28
29template <typename T>
30struct Test2 : Base {
31  using Base::Base;
32};
33
34template <typename B>
35struct Test3 : B {
36  using B::B;
37};
38
39#elif !defined(HEADER2)
40#define HEADER2
41
42Test test1a(42);
43Test test1b(nullptr);
44Test2<int> test2a(42);
45Test2<int> test2b(nullptr);
46Test3<Base> test3a(42);
47Test3<Base> test3b(nullptr);
48
49#pragma clang __debug dump Test
50#pragma clang __debug dump Test2
51
52#else
53
54Test retest1a(42);
55Test retest1b(nullptr);
56Test2<int> retest2a(42);
57Test2<int> retest2b(nullptr);
58Test3<Base> retest3a(42);
59Test3<Base> retest3b(nullptr);
60
61#endif
62