[PATCH] D61027: Fix crash on switch conditions of non-integer types in templates
Elizabeth Andrews via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 24 14:22:21 PDT 2019
eandrews added a comment.
I ran the test you provided and it does throw errors without instantiation
bash-4.2$ clang -cc1 test/SemaTemplate/test2.cpp
test/SemaTemplate/test2.cpp:3:7: error: statement requires expression of integer type ('int *' invalid)
switch (N) case 0:; // should be diagnosed
^ ~
test/SemaTemplate/test2.cpp:4:23: error: value of type 'int *' is not implicitly convertible to 'int'
switch (0) case N:; // should be diagnosed
^
test/SemaTemplate/test2.cpp:4:25: warning: switch statement has empty body
switch (0) case N:; // should be diagnosed
^
test/SemaTemplate/test2.cpp:4:25: note: put the semicolon on a separate line to silence this warning
1 warning and 2 errors generated.
However, I am surprised it does since I expected it not to :) For example the lit test in this patch will not throw an error without the instantiation. I need to debug this further to understand what's happening. Thanks for taking a look!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61027/new/
https://reviews.llvm.org/D61027
More information about the cfe-commits
mailing list