https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95553

            Bug ID: 95553
           Summary: Incorrect/misspelled designators not triggering
                    compilation error
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alex at weej dot com
  Target Milestone: ---

The following code, I believe, should not compile in C++20 or otherwise (we use
it in gnu++17 mode).

#include <string>

auto take_a_string(std::string const& wat) -> void;

auto test() {
    take_a_string({.anything_goes_here = "banana"});
}


Tested this on GCC 7 and GCC trunk today on https://godbolt.org/z/ANNyL6

Note that Clang does treat this as an error.

Thanks

Reply via email to