[Bug c++/86074] gcc fails to compile a code sample

2018-06-18 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86074

Jonathan Wakely  changed:

   What|Removed |Added

 CC||bluescarni at gmail dot com

--- Comment #4 from Jonathan Wakely  ---
*** Bug 78925 has been marked as a duplicate of this bug. ***

[Bug c++/86074] gcc fails to compile a code sample

2018-06-06 Thread nathan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86074

Nathan Sidwell  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from Nathan Sidwell  ---
Yeah, it's invalid.  The template friend operator== function's signature does
not depend on the enclosing template at all.  so, when instantiated in say
simpleAllocator and simpleAllocator, will collide.

[Bug c++/86074] gcc fails to compile a code sample

2018-06-06 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86074

--- Comment #2 from Andrew Pinski  ---
Moving the definition of the operator== and operator!= out from the template
class, then the code works.

[Bug c++/86074] gcc fails to compile a code sample

2018-06-06 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86074

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2018-06-07
 CC||jason at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org,
   ||nathan at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Note that ICC 18 also rejects with:

(33): error: function template "operator==" has already been defined

  friend bool operator==(SimpleAllocator const & lhs, SimpleAllocator
const & rhs)

  ^

  detected during:

instantiation of class "SimpleAllocator [with T=char]" at line
88 of
"/opt/compiler-explorer/gcc-6.3.0/bin/../include/c++/6.3.0/bits/alloc_traits.h"

instantiation of class "std::allocator_traits<_Alloc> [with
_Alloc=SimpleAllocator]" at line 52 of
"/opt/compiler-explorer/gcc-6.3.0/bin/../include/c++/6.3.0/ext/alloc_traits.h"

instantiation of class "__gnu_cxx::__alloc_traits<_Alloc> [with
_Alloc=SimpleAllocator]" at line 75 of
"/opt/compiler-explorer/gcc-6.3.0/bin/../include/c++/6.3.0/bits/basic_string.h"

instantiation of class "std::__cxx11::basic_string<_CharT, _Traits,
_Alloc> [with _CharT=char, _Traits=std::char_traits,
_Alloc=SimpleAllocator]" at line 56

(39): error: function template "operator!=" has already been defined

  friend bool operator!=(SimpleAllocator const & lhs, SimpleAllocator
const & rhs)

  ^

  detected during:

instantiation of class "SimpleAllocator [with T=char]" at line
88 of
"/opt/compiler-explorer/gcc-6.3.0/bin/../include/c++/6.3.0/bits/alloc_traits.h"

instantiation of class "std::allocator_traits<_Alloc> [with
_Alloc=SimpleAllocator]" at line 52 of
"/opt/compiler-explorer/gcc-6.3.0/bin/../include/c++/6.3.0/ext/alloc_traits.h"

instantiation of class "__gnu_cxx::__alloc_traits<_Alloc> [with
_Alloc=SimpleAllocator]" at line 75 of
"/opt/compiler-explorer/gcc-6.3.0/bin/../include/c++/6.3.0/bits/basic_string.h"

instantiation of class "std::__cxx11::basic_string<_CharT, _Traits,
_Alloc> [with _CharT=char, _Traits=std::char_traits,
_Alloc=SimpleAllocator]" at line 56

compilation aborted for  (code 2)

Compiler returned: 2

Is it really a valid code snippet?