https://bugs.llvm.org/show_bug.cgi?id=47689

            Bug ID: 47689
           Summary: [clang-cl] Implicit instantiation of template within
                    its own definition inside noexcept of friend member
                    function
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: rixr...@gmail.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

Boost asio the following workaround:
https://github.com/chriskohlhoff/asio/blob/38fda8d/asio/include/asio/execution/blocking.hpp#L328-L336

The first one for clang was fixed in 8c98c880. However there remains a
workaround for MSVC compiler.
The latest MSVC (19.27.29112) is able to handle both cases, but clang-cl is
able to handle only the second case.

Consider the following minified example:

    template <typename T>
    struct false_t {
        static constexpr bool value = false;
    };

    template <int I = 0>
    struct S {
        using t = void;
        friend void query() noexcept(false_t<S<>::t>::value) {}
    };

MSVC is able to compile this:

    C:\boost_test>cl /c test.cpp
    Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29112 for x64
    Copyright (C) Microsoft Corporation.  All rights reserved.
    test.cpp

However, clang-cl is unable to compile:

    C:\boost_test>C:\llvm\llvm-11.0.0rc4\bin\clang-cl.exe /c 
    test.cpp
    test.cpp(9,42): error: implicit instantiation of template 'S<0>' within its
own definition
    friend void query() noexcept(false_t<S<>::t>::value) {}
                                         ^
    1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to