Page Menu
Home
Search
Configure Global Search
Log In
Paste
P1290
(An Untitled Masterwork)
Active
Public
Actions
Authored by
Sergey Sharybin (sergey)
on Mar 10 2020, 3:22 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Tags
None
Subscribers
None
// GCC case: gcc-9 -Wall -Wextra
// Clang case: clang-9 -Wall -Wextra
typedef enum MyEnum {
A,
B,
C,
} MyEnum;
typedef enum MyOtherEnum {
D,
E,
F,
} MyOtherEnum;
void foo(MyEnum a) {
(void)a;
}
void bar(MyOtherEnum a) {
(void)a;
}
void baz(void* a) {
(void)a;
}
int main() {
foo(10);
foo(A | D);
bar(10);
bar(A | D);
foo(D); // Fine GCC (implicitly from MyEnum -> int -> MyOtherEnum).
// Warning in Clang.
bar(A); // Fine GCC (implicitly from MyOtherEnum -> int -> MyEnum).
// Warning in Clang.
baz(A); // Fine in GCC (A is value of 0, which can be implicitly converted to pointer).
// Warning in Clang.
baz(D); // Fine in GCC (A is value of 0, which can be implicitly converted to pointer).
// Warning in Clang.
baz(B); // Warning in GCC,
// Warning in Clang.
baz(C); // Warning in GCC.
// Warning in Clang.
return 0;
}
Event Timeline
Sergey Sharybin (sergey)
created this paste.
Mar 10 2020, 3:22 PM
Sergey Sharybin (sergey)
created this object with edit policy "Administrators".
Sergey Sharybin (sergey)
edited the content of this paste.
(Show Details)
Sergey Sharybin (sergey)
updated the paste's language from
autodetect
to
c
.
Sergey Sharybin (sergey)
mentioned this in
D7046: CodeCleanup: Added eImBufFlags enum
.
Mar 10 2020, 3:32 PM
Log In to Comment