Branch: refs/heads/main
Revision: 48824fa
Author: mppf
Link: Use value-initialization to avoid clang warning by mppf · Pull Request #19338 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #19338 from mppf/followup-19299-clang
Use value-initialization to avoid clang warning
Follow-up to #19299.
This PR addresses a warning from clang when building chpl
without
CHPL_DEVELOPER
and with make WARNINGS=1
.
We had this in the ASTNode visitor template (where ReturnType
is a
template parameter):
ReturnType dummy;
assert(false && "this code should never be run");
return dummy;
Change it to this instead to avoid a warning from clang that dummy
is
uninitialized (when ReturnType is int/bool/etc).
assert(false && "this code should never be run");
return ReturnType();
This is a value initialization in C++ and if ReturnType
is int
it
will produce 0
.
Reviewed by @ronawho - thanks!
Modified Files:
M compiler/dyno/include/chpl/uast/ASTNode.h
Compare: https://github.com/chapel-lang/chapel/compare/d027d572a7eb...48824fa1ae7e