// RUN: clang-cc -emit-llvm-only %s template struct Num { T value_; public: Num(T value) : value_(value) {} T get() const { return value_; } template struct Rep { U count_; Rep(U count) : count_(count) {} friend Num operator*(const Num &a, const Rep &n) { Num x = 0; for (U count = n.count_; count; --count) x += a; return x; } }; friend Num operator+(const Num &a, const Num &b) { return a.value_ + b.value_; } Num& operator+=(const Num& b) { value_ += b.value_; return *this; } class Representation {}; friend class Representation; }; class A { template friend bool iszero(const A &a) throw(); }; template class B_iterator; template class B { friend class B_iterator; }; int calc1() { Num left = -1; Num right = 1; Num result = left + right; return result.get(); } int calc2() { Num x = 3; Num::Rep n = (char) 10; Num result = x * n; return result.get(); }