public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95553] New: Incorrect/misspelled designators not triggering compilation error
@ 2020-06-05 17:03 alex at weej dot com
  2020-06-05 17:06 ` [Bug c++/95553] " mpolacek at gcc dot gnu.org
  2020-06-08  8:44 ` sergey at murzin dot pw
  0 siblings, 2 replies; 3+ messages in thread
From: alex at weej dot com @ 2020-06-05 17:03 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/95553] Incorrect/misspelled designators not triggering compilation error
  2020-06-05 17:03 [Bug c++/95553] New: Incorrect/misspelled designators not triggering compilation error alex at weej dot com
@ 2020-06-05 17:06 ` mpolacek at gcc dot gnu.org
  2020-06-08  8:44 ` sergey at murzin dot pw
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-05 17:06 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We warn with -Wpedantic and error with -pedantic-errors.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/95553] Incorrect/misspelled designators not triggering compilation error
  2020-06-05 17:03 [Bug c++/95553] New: Incorrect/misspelled designators not triggering compilation error alex at weej dot com
  2020-06-05 17:06 ` [Bug c++/95553] " mpolacek at gcc dot gnu.org
@ 2020-06-08  8:44 ` sergey at murzin dot pw
  1 sibling, 0 replies; 3+ messages in thread
From: sergey at murzin dot pw @ 2020-06-08  8:44 UTC (permalink / raw)
  To: gcc-bugs

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

Sergei Murzin <sergey at murzin dot pw> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sergey at murzin dot pw

--- Comment #2 from Sergei Murzin <sergey at murzin dot pw> ---
(In reply to Marek Polacek from comment #1)
> We warn with -Wpedantic and error with -pedantic-errors.

That is warning for using designated initializers pre-C++20. With C++20 above
code compiles with -Wpedantic without error or warning.
The problem above though, is that the deisgnated intializer is successfully
constructing a string using non-existent designator.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-08  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05 17:03 [Bug c++/95553] New: Incorrect/misspelled designators not triggering compilation error alex at weej dot com
2020-06-05 17:06 ` [Bug c++/95553] " mpolacek at gcc dot gnu.org
2020-06-08  8:44 ` sergey at murzin dot pw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).