96 lines · cpp
1// RUN: %clang_cc1 -ast-print -std=c++14 %s | FileCheck %s2 3namespace ns {4 5struct Wrapper {6class Inner {7 Inner();8 Inner(int);9 ~Inner();10 11 void operator += (int);12 13 template<typename T>14 void member();15 16 static void staticMember();17 18 operator int();19 20 operator ns::Wrapper();21 // CHECK: operator ns::Wrapper()22};23};24 25Wrapper::Inner::Inner() { }26// CHECK: Wrapper::Inner::Inner()27 28void Wrapper::Inner::operator +=(int) { }29// CHECK: void Wrapper::Inner::operator+=(int)30 31}32 33ns::Wrapper::Inner::Inner(int) { }34// CHECK: ns::Wrapper::Inner::Inner(int)35 36ns::Wrapper::Inner::~Inner() { }37// CHECK: ns::Wrapper::Inner::~Inner()38 39template<typename T>40void ::ns::Wrapper::Inner::member() { }41// CHECK: template <typename T> void ::ns::Wrapper::Inner::member()42 43ns::Wrapper::Inner::operator int() { return 0; }44// CHECK: ns::Wrapper::Inner::operator int()45 46ns::Wrapper::Inner::operator ::ns::Wrapper() { return ns::Wrapper(); }47// CHECK: ns::Wrapper::Inner::operator ::ns::Wrapper()48 49namespace ns {50 51void Wrapper::Inner::staticMember() { }52// CHECK: void Wrapper::Inner::staticMember()53 54}55 56template<int x, typename T>57class TemplateRecord {58 void function();59 template<typename U> void functionTemplate(T, U);60};61 62template<int x, typename T>63void TemplateRecord<x, T>::function() { }64// CHECK: template <int x, typename T> void TemplateRecord<x, T>::function()65 66template<int x, typename T>67template<typename U>68void TemplateRecord<x, T>::functionTemplate(T, U) { }69// CHECK: template <int x, typename T> template <typename U> void TemplateRecord<x, T>::functionTemplate(T, U)70 71template<>72class TemplateRecord<0, int> {73 void function();74 template<typename U> void functionTemplate(int, U);75};76 77void TemplateRecord<0, int>::function() { }78// CHECK: void TemplateRecord<0, int>::function()79 80template<typename U>81void TemplateRecord<0, int>::functionTemplate(int, U) { }82// CHECK: template <typename U> void TemplateRecord<0, int>::functionTemplate(int, U)83 84template<typename T>85struct OuterTemplateRecord {86 template<typename U>87 struct Inner {88 void function();89 };90};91 92template<typename T>93template<typename U>94void OuterTemplateRecord<T>::Inner<U>::function() { }95// CHECK: template <typename T> template <typename U> void OuterTemplateRecord<T>::Inner<U>::function()96