[Bug libstdc++/56627] New: class hash instead of struct hash

2013-03-15 Thread andreas.hansson at gmail dot com


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: unassig...@gcc.gnu.org

ReportedBy: andreas.hans...@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 friend class hash;

#endif



class should be struct


[Bug libstdc++/56627] class hash instead of struct hash

2013-03-15 Thread andreas.hansson at gmail dot com


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



--- Comment #2 from ahansson  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.


[Bug libstdc++/56627] class hash instead of struct hash

2013-03-16 Thread andreas.hansson at gmail dot com


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



--- Comment #6 from ahansson  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.