| 1 |
// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-member-init,hicpp-member-init,modernize-use-emplace,hicpp-use-emplace %t -- \ |
| 2 |
//// RUN: -config='{CheckOptions: { \ |
| 3 |
//// RUN: cppcoreguidelines-pro-type-member-init.UseAssignment: true, \ |
| 4 |
//// RUN: }}' |
| 5 |
|
| 6 |
class Foo { |
| 7 |
public: |
| 8 |
Foo() : _num1(0) |
| 9 |
// CHECK-MESSAGES: warning: constructor does not initialize these fields: _num2 [cppcoreguidelines-pro-type-member-init,hicpp-member-init] |
| 10 |
// CHECK-MESSAGES: note: cannot apply fix-it because an alias checker has suggested a different fix-it; please remove one of the checkers ('cppcoreguidelines-pro-type-member-init', 'hicpp-member-init') or ensure they are both configured the same |
| 11 |
{ |
| 12 |
_num1 = 10; |
| 13 |
} |
| 14 |
|
| 15 |
int use_the_members() const { |
| 16 |
return _num1 + _num2; |
| 17 |
} |
| 18 |
|
| 19 |
private: |
| 20 |
int _num1; |
| 21 |
int _num2; |
| 22 |
// CHECK-FIXES: _num2; |
| 23 |
}; |