Improve the compiler error by removing some noise from it.

The "deleted" overload error is useless to users. By passing some dummy string to the base class constructor we use a valid constructor and remove the unintended use of the deleted default constructor.

PiperOrigin-RevId: 452826509
Change-Id: I5430a373c8e7e3a13336d2c42899e0e59444620b
pull/1194/head
Samuel Benzaquen 3 years ago committed by Copybara-Service
parent fa5d5f4c26
commit 47345f63b9
  1. 3
      absl/strings/internal/str_format/bind.h

@ -143,7 +143,8 @@ class FormatSpecTemplate
template <typename T = void>
FormatSpecTemplate(string_view s) // NOLINT
__attribute__((enable_if(str_format_internal::EnsureConstexpr(s),
"constexpr trap"))) {
"constexpr trap")))
: Base("to avoid noise in the compiler error") {
static_assert(sizeof(T*) == 0,
"Format specified does not match the arguments passed.");
}

Loading…
Cancel
Save