[PATCH] D146503: Fix highlighting issue with _complex and initialization list with more than 2 items
NagaChaitanya Vellanki via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 21 12:48:23 PDT 2023
chaitanyav added a comment.
test outputs for C, C++
_Complex float invalid2 = { 1, 2, 3 };
^
test.cpp:2:34: error: excess elements in scalar initializer
_Complex double dd = {1.0, 2.0 , 3.0};
^~~
test.cpp:3:32: error: excess elements in scalar initializer
_Complex float fd = {1.0, 2.0, 3.0, 4.0, 5.0};
^~~
test.cpp:4:42: error: excess elements in scalar initializer
constexpr _Complex double d = {1.0, 2.0, 3.0, 45};
^~~
test.cpp:11:23: error: no viable conversion from 'foo' to 'double'
_Complex double ds = {f, 1.0, b};
^
test.cpp:13:28: error: no viable conversion from 'foo' to 'double'
_Complex double fg = {1.0, f};
^
test.cpp:15:33: error: excess elements in scalar initializer
_Complex double gg = {1.0, 2.0, f};
^
7 errors generated.
test.c:1:35: warning: excess elements in scalar initializer [-Wexcess-initializers]
_Complex float invalid2 = { 1, 2, 3 };
^
test.c:2:34: warning: excess elements in scalar initializer [-Wexcess-initializers]
_Complex double dd = {1.0, 2.0 , 3.0};
^~~
test.c:3:32: warning: excess elements in scalar initializer [-Wexcess-initializers]
_Complex float fd = {1.0, 2.0, 3.0, 4.0, 5.0};
^~~
test.c:4:38: warning: excess elements in scalar initializer [-Wexcess-initializers]
const _Complex double d = {1.0, 2.0, 3.0, 45};
^~~
test.c:11:23: error: initializing 'double' with an expression of incompatible type 'struct foo'
_Complex double ds = {f, 1.0, b};
^
test.c:13:28: error: initializing 'double' with an expression of incompatible type 'struct foo'
_Complex double fg = {1.0, f};
^
test.c:15:33: warning: excess elements in scalar initializer [-Wexcess-initializers]
_Complex double gg = {1.0, 2.0, f};
^
test.c:19:22: error: scalar initializer cannot be empty
_Complex double dx = {};
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146503/new/
https://reviews.llvm.org/D146503
More information about the cfe-commits
mailing list