-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featuregood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute
Description
The new static_assert message is great, there are some simple messages where an expansion isn't particularly helpful.
For example
constexpr auto is_gitlab = false;
constexpr auto is_weekend = false;
static_assert(is_gitlab or is_weekend);will give us
<source>:4:1: error: static assertion failed due to requirement 'is_gitlab || is_weekend'
static_assert(is_gitlab or is_weekend);
^ ~~~~~~~~~~~~~~~~~~~~~~~
<source>:4:25: note: expression evaluates to 'false || false'
static_assert(is_gitlab or is_weekend);
~~~~~~~~~~^~~~~~~~~~~~~The note isn't necessary, since the error implies that the expression will be false or false. I noticed that if we change the expression to a conjunction, we get a simpler message, so it looks like the machinery might already be present.
<source>:4:1: error: static assertion failed due to requirement 'is_gitlab'
static_assert(is_gitlab and is_weekend);
^ ~~~~~~~~~We should---on a best effort basis---aim to eliminate expansions that don't add value to minimise user frustration (this will give us slightly more room to have longer diagnostics elsewhere).
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featuregood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute