Last active
August 29, 2015 14:03
-
-
Save andyfriesen/dfbc80983e548f0a965c to your computer and use it in GitHub Desktop.
It would be nice if this generated a compiler warning
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
#include <stdio.h> | |
enum Enumeration { | |
ENUM = 0, | |
}; | |
struct S final { | |
explicit S(unsigned short id) | |
: S(ENUM, value) | |
{ } | |
S(Enumeration e, unsigned short id) | |
: value((e << 24) | id) | |
{ } | |
unsigned int value; | |
}; | |
int main() { | |
S s(1); | |
printf("Value should be 1: %i\n", s.value); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment