From 47345f63b94a0ea8fbfb3c49ed5b185f2b649f1a Mon Sep 17 00:00:00 2001 From: Samuel Benzaquen Date: Fri, 3 Jun 2022 13:01:35 -0700 Subject: 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 --- absl/strings/internal/str_format/bind.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'absl/strings/internal/str_format') diff --git a/absl/strings/internal/str_format/bind.h b/absl/strings/internal/str_format/bind.h index dcaa5dd0..80f29654 100644 --- a/absl/strings/internal/str_format/bind.h +++ b/absl/strings/internal/str_format/bind.h @@ -143,7 +143,8 @@ class FormatSpecTemplate template 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."); } -- cgit v1.2.3