public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/62165] New: Misleading error messages when using "impossible" brace initializer list
@ 2014-08-17 12:45 public at enkore dot de
  2014-08-17 13:51 ` [Bug c++/62165] " public at enkore dot de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: public at enkore dot de @ 2014-08-17 12:45 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5855 bytes --]

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

            Bug ID: 62165
           Summary: Misleading error messages when using "impossible"
                    brace initializer list
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: public at enkore dot de

Created attachment 33343
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33343&action=edit
Demonstrates the issue.

When trying to brace-initialize a container or something similar with
non-aggregate key or value types the error messages become long and misleading.
Since such initialization is not possible the error message should simply point
to that and why it is not possible.

err_neg.cc generates a pile of error messages unrelated to the error cause — in
this example the issue is simply that struct s is not an aggregate since it has
default values and thus an implicit default ctor. Thus it is not possible to
initialize a map with that value typ via brace initialization. A smart compiler
should point that out.
>From gcc-bugs-return-458663-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Aug 17 13:45:36 2014
Return-Path: <gcc-bugs-return-458663-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31358 invoked by alias); 17 Aug 2014 13:45:35 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 31305 invoked by uid 48); 17 Aug 2014 13:45:28 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/62165] Misleading error messages when using "impossible" brace initializer list
Date: Sun, 17 Aug 2014 13:45:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: WAITING
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-62165-4-UFh99i4OYc@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62165-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62165-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg01160.txt.bz2
Content-length: 696

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-08-17
                 CC|                            |manu at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Can you create a testcase without using map or any other #include? 

https://gcc.gnu.org/bugs/minimize.html
>From gcc-bugs-return-458664-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Aug 17 13:50:05 2014
Return-Path: <gcc-bugs-return-458664-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2004 invoked by alias); 17 Aug 2014 13:50:05 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 1968 invoked by uid 48); 17 Aug 2014 13:50:01 -0000
From: "public at enkore dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/62165] Misleading error messages when using "impossible" brace initializer list
Date: Sun, 17 Aug 2014 13:50:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: public at enkore dot de
X-Bugzilla-Status: WAITING
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-62165-4-pkw23Rj3Ij@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62165-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62165-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg01161.txt.bz2
Content-length: 338

https://gcc.gnu.org/bugzilla/show_bug.cgi?idb165

--- Comment #2 from marian <public at enkore dot de> ---
Created attachment 33344
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id3344&actioníit
Simpler example

Sure, but it doesn't produce the vast amount of error messages as with the map
example - still not good, though :)


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

* [Bug c++/62165] Misleading error messages when using "impossible" brace initializer list
  2014-08-17 12:45 [Bug c++/62165] New: Misleading error messages when using "impossible" brace initializer list public at enkore dot de
@ 2014-08-17 13:51 ` public at enkore dot de
  2014-08-17 14:45 ` manu at gcc dot gnu.org
  2021-08-27 19:22 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: public at enkore dot de @ 2014-08-17 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from marian <public at enkore dot de> ---
A good error message about this would probably be something like "cannot
brace-initialize `xyz` because `some type` is not an aggregate"


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

* [Bug c++/62165] Misleading error messages when using "impossible" brace initializer list
  2014-08-17 12:45 [Bug c++/62165] New: Misleading error messages when using "impossible" brace initializer list public at enkore dot de
  2014-08-17 13:51 ` [Bug c++/62165] " public at enkore dot de
@ 2014-08-17 14:45 ` manu at gcc dot gnu.org
  2021-08-27 19:22 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2014-08-17 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Yes, I agree the error is not very clear. It would be even more helpful if it
said why type is not an aggregate (in this case, because there is an equal
initializer for a non-static member).
>From gcc-bugs-return-458667-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Aug 17 14:53:45 2014
Return-Path: <gcc-bugs-return-458667-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22819 invoked by alias); 17 Aug 2014 14:53:45 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 22749 invoked by uid 48); 17 Aug 2014 14:53:35 -0000
From: "cand at gmx dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61721] GCC 4.8-4.10 miscompiles webkit hashing
Date: Sun, 17 Aug 2014 14:53:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: cand at gmx dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cf_known_to_fail
Message-ID: <bug-61721-4-tjzJLIWzzo@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61721-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61721-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg01164.txt.bz2
Content-length: 991

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida721

Lauri Kasanen <cand at gmx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.10.0                      |5.0

--- Comment #7 from Lauri Kasanen <cand at gmx dot com> ---
Latest trunk (214073) is still broken.

Using latest trunk, I tried all optimization sub-options in
O2 to find the smallest hammer that fixes it.

-O2 -fno-thread-jumps: crash
-O2 -fno-align-functions: crash
...
-O2 -fno-use-caller-save: crash

The only combos that worked:

-O2 -fno-inline-small-functions: works
-O2 -fno-strict-aliasing: works

Moving to -O1 with those:

-O1 -finline-small-functions: works
-O1 -fstrict-aliasing: works
-O1 -fstrict-aliasing -finline-small-functions: crash


This does point to the code being wrong somehow, but in that case,
-Wall -Wextra should say something, and this would be a missing warning
bug in gcc.


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

* [Bug c++/62165] Misleading error messages when using "impossible" brace initializer list
  2014-08-17 12:45 [Bug c++/62165] New: Misleading error messages when using "impossible" brace initializer list public at enkore dot de
  2014-08-17 13:51 ` [Bug c++/62165] " public at enkore dot de
  2014-08-17 14:45 ` manu at gcc dot gnu.org
@ 2021-08-27 19:22 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-27 19:22 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
   Last reconfirmed|2014-08-17 00:00:00         |2021-8-27

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I don't know how important this is as the code in question is only invalid
C++11 (and C++98 but for other reasons) and is valid c++14 code.

clang and ICC (EDG) both have a similar error message as GCC does.

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

end of thread, other threads:[~2021-08-27 19:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-17 12:45 [Bug c++/62165] New: Misleading error messages when using "impossible" brace initializer list public at enkore dot de
2014-08-17 13:51 ` [Bug c++/62165] " public at enkore dot de
2014-08-17 14:45 ` manu at gcc dot gnu.org
2021-08-27 19:22 ` pinskia 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).