File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -71,3 +71,23 @@ void template_based_on_ostream(B<int> &os) {
7171 // CHECK-MESSAGES: [[@LINE-1]]:6: warning: 'unsigned char' passed to 'operator<<' outputs as character instead of integer
7272}
7373
74+ template <class T > void template_fn_1 (T &os) {
75+ unsigned char unsigned_value = 9 ;
76+ os << unsigned_value;
77+ // CHECK-MESSAGES: [[@LINE-1]]:6: warning: 'unsigned char' passed to 'operator<<' outputs as character instead of integer
78+ }
79+ template <class T > void template_fn_2 (std::ostream &os) {
80+ T unsigned_value = 9 ;
81+ os << unsigned_value;
82+ // CHECK-MESSAGES: [[@LINE-1]]:6: warning: 'unsigned char' passed to 'operator<<' outputs as character instead of integer
83+ }
84+ template <class T > void template_fn_3 (std::ostream &os) {
85+ T unsigned_value = 9 ;
86+ os << unsigned_value;
87+ }
88+ void call_template_fn () {
89+ A a{};
90+ template_fn_1 (a);
91+ template_fn_2<unsigned char >(a);
92+ template_fn_3<char >(a);
93+ }
You can’t perform that action at this time.
0 commit comments