public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95559] New: Compiling "{{}}" result is inconsistent in different versions
@ 2020-06-06  4:11 haoxintu at gmail dot com
  2020-06-09 22:41 ` [Bug c++/95559] GCC fails to compile "{{}}" in some versions mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-06  4:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95559
           Summary: Compiling "{{}}" result is inconsistent in different
                    versions
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

This case test.cc

#include<iostream>
int main() {
    return {{}};
}

In the version of GCC 6.1 - 8.4, it's compiled ok.

But in GCC 6.1 lower and 8.4 higher version, for example, in GCC trunk

$g++-trunk test.cc 
test.cc: In function 'int main()':
test.cc:3:15: error: too many braces around scalar initializer for type 'int'
    3 |     int var = {{}};
      | 

I also compiled test.cc in recent released Clang, and they all accept "{{}}".

Should GCC compile "{{}}" fine also? I think this is a supported feature
according to https://en.cppreference.com/w/cpp/language/return.

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

end of thread, other threads:[~2020-06-10 13:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-06  4:11 [Bug c++/95559] New: Compiling "{{}}" result is inconsistent in different versions haoxintu at gmail dot com
2020-06-09 22:41 ` [Bug c++/95559] GCC fails to compile "{{}}" in some versions mpolacek at gcc dot gnu.org
2020-06-09 23:36 ` haoxintu at gmail dot com
2020-06-09 23:39 ` haoxintu at gmail dot com
2020-06-10 13:26 ` [Bug c++/95559] GCC accepts "too many braces around scalar initializer " in the version of 6.1 - 8.4 mpolacek at gcc dot gnu.org
2020-06-10 13:33 ` haoxintu at gmail dot com
2020-06-10 13:34 ` mpolacek at gcc dot gnu.org

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).