[clang] [clang-tools-extra] [Clang] [Sema] Diagnose unknown std::initializer_list layout in SemaInit (PR #95580)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 19 05:39:08 PDT 2024


================
@@ -12216,6 +12216,9 @@ def err_std_source_location_impl_not_found : Error<
 def err_std_source_location_impl_malformed : Error<
   "'std::source_location::__impl' must be standard-layout and have only two 'const char *' fields '_M_file_name' and '_M_function_name', and two integral fields '_M_line' and '_M_column'">;
 
+def err_std_initializer_list_malformed : Error<
+  "%0 layout not recognized. Must be a struct with two fields, a 'const E *' and either another 'const E *' or a 'std::size_t'">;
----------------
Sirraide wrote:

```suggestion
  "%0 layout not recognized. Must be a non-polymorphic class type with no bases and two fields: a 'const E *' and either another 'const E *' or a 'std::size_t'">;
```
I do realise that we’re cramming quite a bit of information into this diagnostic here, but so does `err_std_source_location_impl_malformed`, and this is not a diagnostic anyone except for library implementers should ever see, so this is probably fine imo.

https://github.com/llvm/llvm-project/pull/95580


More information about the cfe-commits mailing list