Skip to content

ICE while considering conversion functions in the context of copy-initializing a type from the same type #50891

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 51549
Version 11.0
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@saxbophone,@zygoloid

Extended Description

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.

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillac++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"conceptsC++20 concepts

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions