https://bugs.llvm.org/show_bug.cgi?id=39809
Bug ID: 39809
Summary: Wrong type of ternary expression; (void const*)0
erroneously treated as the null pointer constant
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: psko...@gmail.com
CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
richard-l...@metafoo.co.uk
This compiles on gcc:
//null-ptr constant select other type
_Generic( 0?(int const*)0: (void*)0, int const*: (void)0);
//not null-ptr constant, ptr to void with combined qualifs
_Generic( 0?(int const*)0: (void*)1, void const*: (void)0);
//not null-ptr constant, ptr to void with combined qualifs
_Generic( 0?(int volatile*)0:(void const*)1, void volatile const*:
(void)0);
//GCC and CLANG disagree
//not null-ptr constant, ptr to void with combined qualifs
_Generic( 0?(int volatile*)0:(void const*)0, void volatile const*:
(void)0);
but clang types the last ternary as `int volatile*` treating `(void const*)0`
as the null pointer constant whereas gcc doesn't treat it as such.
I believe gcc is right here. The C standard defines the null pointer constant
as either `0` or `(void*)0`. It's weird, but `(void const*)0` doesn't qualify
(or qualifies way too much if you know what I mean).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs