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

Justin Bassett <jbassett271 at gmail dot com> changed:

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

--- Comment #1 from Justin Bassett <jbassett271 at gmail dot com> ---
I believe the following is another case of this bug:
https://godbolt.org/z/9r9QdS . MSVC and Clang compile this fine; GCC only
compiles it fine if the `= delete` is not present. It's really weird that GCC
selects the deleted `begin()` even though it does not take an argument.

namespace foo {
    namespace detail {
        void begin() = delete;
    }

    inline auto begin = [](auto&& a) {
        using detail::begin;
        return begin(a);
    };
}

#include <array>

int main() {
    return *foo::begin(std::array<int, 2>{1, 2});
}


Error message:

<source>: In instantiation of 'foo::<lambda(auto:1&&)> [with auto:1 =
std::array<int, 2>]':

<source>:15:48:   required from here

<source>:8:21: error: use of deleted function 'void foo::detail::begin()'

         return begin(a);

                ~~~~~^~~

<source>:3:14: note: declared here

         void begin() = delete;

              ^~~~~

<source>: In function 'int main()':

<source>:15:23: error: void value not ignored as it ought to be

     return *foo::begin(std::array<int, 2>{1, 2});

             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to