#include <cstdio>

template<typename T>
class Test {
private:
    T value_;

public:
    mutable bool has_copies;

    Test(const T& value) : value_(value), has_copies(false) {}

    template<typename Related> // remove template here to fix behavior
    Test(const Test<Related>& t) {
        printf("In copy constructor\n"); fflush(stdout);
        value_ = t.value_;
        has_copies = true;
        t.has_copies = true;
    }
};

int main() {
    Test<int> t1(42);
    printf("Before constructor\n");
    Test<int> t2(t1);
    printf("After constructor:\n");
    printf("    t1 thinks it %s copies\n", t1.has_copies ? "has" : "doesn't have");
    printf("    t2 thinks it %s copies\n", t2.has_copies ? "has" : "doesn't have");
}