[llvm-bugs] [Bug 51549] New: considering conversion functions in the context of copy-initializing a type from the same type

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 19 13:58:44 PDT 2021


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

            Bug ID: 51549
           Summary: considering conversion functions in the context of
                    copy-initializing a type from the same type
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: barry.revzin 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

Reduced from StackOverflow (https://stackoverflow.com/q/68853472/2069064):

template <typename T>
concept Numeric =
    requires(T a) {
        foo(a);
    };

struct Deferred {
    friend void foo(Deferred);
    template <Numeric TO> operator TO();
};

static_assert(Numeric<Deferred>);

clang is trying to check to see if a.operator Derived() is a valid expression
as part of checking if foo(a) is valid. But we shouldn't be going that route
here at all, copy-initializing a Derived from an lvalue of type Derived should
only check constructors, not conversion functions.

-- 
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/20210819/7c0963b6/attachment.html>


More information about the llvm-bugs mailing list