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

Martin Liška <marxin at gcc dot gnu.org> 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 <marxin at gcc dot gnu.org> ---
Note that ICC 18 also rejects with:

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

      friend bool operator==(SimpleAllocator<U> const & lhs, SimpleAllocator<V>
const & rhs)

                  ^

          detected during:

            instantiation of class "SimpleAllocator<T> [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<char>]" 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<char>]" 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<char>,
_Alloc=SimpleAllocator<char>]" at line 56

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

      friend bool operator!=(SimpleAllocator<U> const & lhs, SimpleAllocator<V>
const & rhs)

                  ^

          detected during:

            instantiation of class "SimpleAllocator<T> [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<char>]" 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<char>]" 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<char>,
_Alloc=SimpleAllocator<char>]" at line 56

compilation aborted for <source> (code 2)

Compiler returned: 2

Is it really a valid code snippet?

Reply via email to