Created
November 2, 2017 03:22
-
-
Save nic-hartley/bd068ea703eb7e06b4c2d6b6c703abf4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This gist demonstrates an issue with Clang-Tidy, I think. | |
Basically, you shouldn't be required to initialize all members of a | |
union, for obvious reasons, but Clang-Tidy doesn't care that the | |
"missing" members are part of a union, and tries to get them to be | |
initialized anyway. | |
*/ | |
struct Type { | |
union { | |
int _a; | |
float _b; | |
}; | |
double _c; | |
// Warning here that _b isn't initialized | |
Type(int a, double c) : _a(a), _c(c) {} | |
// Warning here that _a isn't initialized | |
Type(float b, double c) : _b(b), _c(c) {} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment