| 1 | //===--- unused_class_template_ctor-d1.h - test input file for iwyu -------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef INCLUDE_WHAT_YOU_USE_TESTS_CXX_UNUSED_CLASS_TEMPLATE_CTOR_D1_H_ |
| 11 | #define INCLUDE_WHAT_YOU_USE_TESTS_CXX_UNUSED_CLASS_TEMPLATE_CTOR_D1_H_ |
| 12 | |
| 13 | template <class T1, class T2> |
| 14 | class pair { |
| 15 | private: |
| 16 | T1 first_; |
| 17 | T2 second_; |
| 18 | public: |
| 19 | // If T2 is a reference type, 2-argument constructor is valid but 1-argument |
| 20 | // constructor cannot be used. Instantiating 1-argument constructor causes |
| 21 | // |
| 22 | // error: constructor for 'pair<int &, int &>' must explicitly initialize |
| 23 | // the reference member 'second_' |
| 24 | explicit pair(T1 t1) : first_(t1) {} |
| 25 | pair(T1 t1, T2 t2) : first_(t1), second_(t2) {} |
| 26 | }; |
| 27 | |
| 28 | #endif // INCLUDE_WHAT_YOU_USE_TESTS_CXX_UNUSED_CLASS_TEMPLATE_CTOR_D1_H_ |