diff options
author | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
---|---|---|
committer | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
commit | 222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch) | |
tree | 7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/PCH/chain-friend-instantiation.cpp | |
parent | 3d206f03985b50beacae843d880bccdc91a9f424 (diff) |
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/PCH/chain-friend-instantiation.cpp')
-rw-r--r-- | clang/test/PCH/chain-friend-instantiation.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/clang/test/PCH/chain-friend-instantiation.cpp b/clang/test/PCH/chain-friend-instantiation.cpp new file mode 100644 index 0000000..294d979 --- /dev/null +++ b/clang/test/PCH/chain-friend-instantiation.cpp @@ -0,0 +1,61 @@ +// RUN: %clang_cc1 %s -ast-print -o - -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 |