You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.0 KiB
63 lines
1.0 KiB
4 months ago
|
// RUN: %clang_cc1 %s -ast-print -o - -chain-include %s -chain-include %s
|
||
|
// RUN: %clang_cc1 %s -ast-print -o - -fmodules -chain-include %s -chain-include %s
|
||
|
|
||
|
#if !defined(PASS1)
|
||
|
#define PASS1
|
||
|
|
||
|
template <class T> class TClass;
|
||
|
|
||
|
namespace NS {
|
||
|
template <class X, class Y> TClass<X> problematic(X * ptr, const TClass<Y> &src);
|
||
|
|
||
|
template <class T>
|
||
|
class TBaseClass
|
||
|
{
|
||
|
protected:
|
||
|
template <class X, class Y> friend TClass<X> problematic(X * ptr, const TClass<Y> &src);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
template <class T>
|
||
|
class TClass: public NS::TBaseClass<T>
|
||
|
{
|
||
|
public:
|
||
|
inline TClass() { }
|
||
|
};
|
||
|
|
||
|
|
||
|
namespace NS {
|
||
|
template <class X, class T>
|
||
|
TClass<X> problematic(X *ptr, const TClass<T> &src);
|
||
|
}
|
||
|
|
||
|
template <class X, class T>
|
||
|
TClass<X> unconst(const TClass<T> &src);
|
||
|
|
||
|
#elif !defined(PASS2)
|
||
|
#define PASS2
|
||
|
|
||
|
namespace std {
|
||
|
class s {};
|
||
|
}
|
||
|
|
||
|
|
||
|
typedef TClass<std::s> TStr;
|
||
|
|
||
|
struct crash {
|
||
|
TStr str;
|
||
|
|
||
|
crash(const TClass<std::s> p)
|
||
|
{
|
||
|
unconst<TStr>(p);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
#else
|
||
|
|
||
|
void f() {
|
||
|
const TStr p;
|
||
|
crash c(p);
|
||
|
}
|
||
|
|
||
|
#endif
|