[llvm-bugs] [Bug 47689] New: [clang-cl] Implicit instantiation of template within its own definition inside noexcept of friend member function

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 30 07:20:19 PDT 2020


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: unassignedclangbugs at nondot.org
          Reporter: rixript at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200930/3b167907/attachment-0001.html>


More information about the llvm-bugs mailing list