diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h index 5d60bb64bbb20..531750572102c 100644 --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -1459,20 +1459,16 @@ class opt } } - template >> - void setDefaultImpl() { - const OptionValue &V = this->getDefault(); - if (V.hasValue()) - this->setValue(V.getValue()); - else - this->setValue(T()); + void setDefault() override { + if constexpr (std::is_assignable_v) { + const OptionValue &V = this->getDefault(); + if (V.hasValue()) + this->setValue(V.getValue()); + else + this->setValue(DataType()); + } } - template >> - void setDefaultImpl(...) {} - - void setDefault() override { setDefaultImpl(); } - void done() { addArgument(); Parser.initialize();