blob: 294d9791123627a814d303c4bbf611df31fc0a9d [file] [log] [blame]
Douglas Gregor1b59e9c2011-08-25 15:28:26 +00001// RUN: %clang_cc1 %s -ast-print -o - -chain-include %s -chain-include %s
2
3#if !defined(PASS1)
4#define PASS1
5
6template <class T> class TClass;
7
8namespace NS {
9 template <class X, class Y> TClass<X> problematic(X * ptr, const TClass<Y> &src);
10
11 template <class T>
12 class TBaseClass
13 {
14 protected:
15 template <class X, class Y> friend TClass<X> problematic(X * ptr, const TClass<Y> &src);
16 };
17}
18
19template <class T>
20class TClass: public NS::TBaseClass<T>
21{
22public:
23 inline TClass() { }
24};
25
26
27namespace NS {
28 template <class X, class T>
29 TClass<X> problematic(X *ptr, const TClass<T> &src);
30}
31
32template <class X, class T>
33TClass<X> unconst(const TClass<T> &src);
34
35#elif !defined(PASS2)
36#define PASS2
37
38namespace std {
39class s {};
40}
41
42
43typedef TClass<std::s> TStr;
44
45struct crash {
46 TStr str;
47
48 crash(const TClass<std::s> p)
49 {
50 unconst<TStr>(p);
51 }
52};
53
54#else
55
56void f() {
57 const TStr p;
58 crash c(p);
59}
60
61#endif