public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/56627] New: class hash instead of struct hash
@ 2013-03-15 18:45 andreas.hansson at gmail dot com
  2013-03-15 19:18 ` [Bug libstdc++/56627] " pinskia at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: andreas.hansson at gmail dot com @ 2013-03-15 18:45 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

             Bug #: 56627
           Summary: class hash instead of struct hash
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: andreas.hansson@gmail.com


In the gcc 4.8.0 c++ standard library headers, bitset and bits/stl_bvector.h
both incorrectly use class instead of struct for the hash function.

For example, bits/stl_bvector.h:

#if __cplusplus >= 201103L
   template<typename> friend class hash;
#endif

class should be struct


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
@ 2013-03-15 19:18 ` pinskia at gcc dot gnu.org
  2013-03-15 21:04 ` andreas.hansson at gmail dot com
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-03-15 19:18 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-03-15 19:18:23 UTC ---
In C++, class and struct are interchangeable.


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
  2013-03-15 19:18 ` [Bug libstdc++/56627] " pinskia at gcc dot gnu.org
@ 2013-03-15 21:04 ` andreas.hansson at gmail dot com
  2013-03-15 21:17 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: andreas.hansson at gmail dot com @ 2013-03-15 21:04 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

--- Comment #2 from ahansson <andreas.hansson at gmail dot com> 2013-03-15 21:04:01 UTC ---
(In reply to comment #1)
> In C++, class and struct are interchangeable.

Agreed. Technically the code is ok, and in line with the language standard. 

However, as at least one of the most popular compilers (clang 3.2 RELEASE with
-Wall) issues a warning for this. Thus, it might be worthwhile fixing.


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
  2013-03-15 19:18 ` [Bug libstdc++/56627] " pinskia at gcc dot gnu.org
  2013-03-15 21:04 ` andreas.hansson at gmail dot com
@ 2013-03-15 21:17 ` pinskia at gcc dot gnu.org
  2013-03-16  2:22 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-03-15 21:17 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-03-15 21:17:15 UTC ---
(In reply to comment #2)
> (In reply to comment #1)rd. 
> However, as at least one of the most popular compilers (clang 3.2 RELEASE with
> -Wall) issues a warning for this. Thus, it might be worthwhile fixing.

And it only issues it because it tries to be compatible with MS's compiler.
  I think this is broken to issue a warning at all and rather see clang fixed
and/or ignored in this case.


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (2 preceding siblings ...)
  2013-03-15 21:17 ` pinskia at gcc dot gnu.org
@ 2013-03-16  2:22 ` redi at gcc dot gnu.org
  2013-03-16  9:40 ` paolo.carlini at oracle dot com
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2013-03-16  2:22 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-03-16 02:22:39 UTC ---
I'm happy to fix things in libstdc++ that are broken and cause real problems
for clang users, but this is correct C++ and causes a spurious warning. Not a
bug, not worth wasting time on.


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (3 preceding siblings ...)
  2013-03-16  2:22 ` redi at gcc dot gnu.org
@ 2013-03-16  9:40 ` paolo.carlini at oracle dot com
  2013-03-16 12:02 ` andreas.hansson at gmail dot com
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-03-16  9:40 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-03-16 09:40:02 UTC ---
I agree. And we discussed it already somewhere.


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (4 preceding siblings ...)
  2013-03-16  9:40 ` paolo.carlini at oracle dot com
@ 2013-03-16 12:02 ` andreas.hansson at gmail dot com
  2013-06-26 21:05 ` paolo.carlini at oracle dot com
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: andreas.hansson at gmail dot com @ 2013-03-16 12:02 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

--- Comment #6 from ahansson <andreas.hansson at gmail dot com> 2013-03-16 12:01:39 UTC ---
(In reply to comment #4)
> I'm happy to fix things in libstdc++ that are broken and cause real problems
> for clang users, but this is correct C++ and causes a spurious warning. Not a
> bug, not worth wasting time on.

The potential for "real problems" was my main reason for pointing it out. I ran
some (unrelated) tests on Fedora Rawhide (fc19) with clang 3.2 RELEASE and gcc
4.8.0 and this issue popped up as -Wall -Werror was used for the project in
question.

The two lines mentioned are the only issues encountered. If it is worth
"fixing" or not I leave up to you to decide, I merely wanted to highlight the
potential issues.


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (5 preceding siblings ...)
  2013-03-16 12:02 ` andreas.hansson at gmail dot com
@ 2013-06-26 21:05 ` paolo.carlini at oracle dot com
  2013-07-30  4:44 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-26 21:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |d.frey at gmx dot de

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
*** Bug 57730 has been marked as a duplicate of this bug. ***


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (6 preceding siblings ...)
  2013-06-26 21:05 ` paolo.carlini at oracle dot com
@ 2013-07-30  4:44 ` pinskia at gcc dot gnu.org
  2013-07-30  4:59 ` whatmannerofburgeristhis at gmail dot com
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-07-30  4:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |whatmannerofburgeristhis@gm
                   |                            |ail.com

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 58025 has been marked as a duplicate of this bug. ***


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (7 preceding siblings ...)
  2013-07-30  4:44 ` pinskia at gcc dot gnu.org
@ 2013-07-30  4:59 ` whatmannerofburgeristhis at gmail dot com
  2013-07-30  5:03 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: whatmannerofburgeristhis at gmail dot com @ 2013-07-30  4:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

--- Comment #9 from Matt Arsenault <whatmannerofburgeristhis at gmail dot com> ---
(In reply to Andrew Pinski from comment #8)
> *** Bug 58025 has been marked as a duplicate of this bug. ***

They don't have to be consistent by the standard, but the purpose of warnings
is not to strictly report deviations from the standard. Many point out likely
mistakes or inconsistencies in "standard" conforming code (e.g. -Wlogical-op).
This is an absolutely trivial fix.


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (8 preceding siblings ...)
  2013-07-30  4:59 ` whatmannerofburgeristhis at gmail dot com
@ 2013-07-30  5:03 ` pinskia at gcc dot gnu.org
  2013-07-30  8:31 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-07-30  5:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Matt Arsenault from comment #9)
> (In reply to Andrew Pinski from comment #8)
> > *** Bug 58025 has been marked as a duplicate of this bug. ***
> 
> They don't have to be consistent by the standard, but the purpose of
> warnings is not to strictly report deviations from the standard. Many point
> out likely mistakes or inconsistencies in "standard" conforming code (e.g.
> -Wlogical-op). This is an absolutely trivial fix.

Actually this warning makes less sense than -Wlogical-op due to the way struct
and class are defined.  -Wlogical-op makes sense since due to forgetting how ||
and && interact, there is no interaction here, only using struct in one case
and class in another which is valid and known what happens even without looking
up what happens.  The real reason why they added this option is due to another
compiler which implements non-standard behavior for struct and class (not
naming the company here but they also don't care about C99).


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (9 preceding siblings ...)
  2013-07-30  5:03 ` pinskia at gcc dot gnu.org
@ 2013-07-30  8:31 ` redi at gcc dot gnu.org
  2013-07-30 14:59 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2013-07-30  8:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I'm think I'm just going to change the code to shut everyone up, despite it
being a nonsense warning about a non-issue, because I'm sick of these
discussions.

Fine, you win, we'll silence the stupid warning.


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (10 preceding siblings ...)
  2013-07-30  8:31 ` redi at gcc dot gnu.org
@ 2013-07-30 14:59 ` redi at gcc dot gnu.org
  2013-07-31 14:22 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2013-07-30 14:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bluescarni at gmail dot com

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 58030 has been marked as a duplicate of this bug. ***


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (11 preceding siblings ...)
  2013-07-30 14:59 ` redi at gcc dot gnu.org
@ 2013-07-31 14:22 ` paolo.carlini at oracle dot com
  2013-07-31 14:32 ` redi at gcc dot gnu.org
  2013-07-31 14:37 ` paolo.carlini at oracle dot com
  14 siblings, 0 replies; 16+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-31 14:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

--- Comment #13 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Jon, I have two spare minutes and if you don't mind I'm taking care of the
stupid change myself.


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (12 preceding siblings ...)
  2013-07-31 14:22 ` paolo.carlini at oracle dot com
@ 2013-07-31 14:32 ` redi at gcc dot gnu.org
  2013-07-31 14:37 ` paolo.carlini at oracle dot com
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2013-07-31 14:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Sure, I was going to do it this evening but please go ahead, thanks.


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

* [Bug libstdc++/56627] class hash instead of struct hash
  2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
                   ` (13 preceding siblings ...)
  2013-07-31 14:32 ` redi at gcc dot gnu.org
@ 2013-07-31 14:37 ` paolo.carlini at oracle dot com
  14 siblings, 0 replies; 16+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-31 14:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56627

--- Comment #15 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done for 4.8.2 and 4.9.0.


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

end of thread, other threads:[~2013-07-31 14:37 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15 18:45 [Bug libstdc++/56627] New: class hash instead of struct hash andreas.hansson at gmail dot com
2013-03-15 19:18 ` [Bug libstdc++/56627] " pinskia at gcc dot gnu.org
2013-03-15 21:04 ` andreas.hansson at gmail dot com
2013-03-15 21:17 ` pinskia at gcc dot gnu.org
2013-03-16  2:22 ` redi at gcc dot gnu.org
2013-03-16  9:40 ` paolo.carlini at oracle dot com
2013-03-16 12:02 ` andreas.hansson at gmail dot com
2013-06-26 21:05 ` paolo.carlini at oracle dot com
2013-07-30  4:44 ` pinskia at gcc dot gnu.org
2013-07-30  4:59 ` whatmannerofburgeristhis at gmail dot com
2013-07-30  5:03 ` pinskia at gcc dot gnu.org
2013-07-30  8:31 ` redi at gcc dot gnu.org
2013-07-30 14:59 ` redi at gcc dot gnu.org
2013-07-31 14:22 ` paolo.carlini at oracle dot com
2013-07-31 14:32 ` redi at gcc dot gnu.org
2013-07-31 14:37 ` paolo.carlini at oracle dot com

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