-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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 analyzerconfirmedVerified by a second partyVerified by a second partyenhancementImproving 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
Clang diagnostic for invalid bool-to-enum template parameter conversion lacks failure detail when compared to GCC, as the following C++ snippet:
enum endianness { little = 0, big };
template <endianness e>
inline void foo() {}
void bar() {
foo<false>();
}Fails as follows on latest clang:
<source>:7:5: error: no matching function for call to 'foo'
7 | foo<false>();
| ^~~~~~~~~~
<source>:4:13: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'big_endian'
4 | inline void foo() {}
GCC explicitly indicates the conversion failure instead:
<source>:4:13: note: template argument deduction/substitution failed:
<source>:7:15: error: could not convert 'false' from 'bool' to 'endianness'
7 | foo<false>();
| ~~~~~~~~~~^~
| |
| bool
Godbolt: https://godbolt.org/z/hnazTn3M7 (cc/ @shafik).
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 analyzerconfirmedVerified by a second partyVerified by a second partyenhancementImproving 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