summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Samuel Benzaquen <sbenza@google.com>2022-06-03 13:01:35 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-06-03 13:02:27 -0700
commit47345f63b94a0ea8fbfb3c49ed5b185f2b649f1a (patch)
tree55c6ffc7fee4cebf23958caa06144d8471bd4f7b
parentfa5d5f4c262ce3d42bfe35439913162aef45ee23 (diff)
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
-rw-r--r--absl/strings/internal/str_format/bind.h3
1 files changed, 2 insertions, 1 deletions
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 <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.");
}