brintos

brintos / llvm-project-archived public Read only

0
0
Text · 741 B · f505186 Raw
29 lines · cpp
1// RUN: %clang_cc1 -std=c++20 -fsyntax-only %s -verify2 3struct S1 {4  operator int();5 6  template <typename T>7  operator T();8};9 10 11// Ensure that no assertion is raised when overload resolution fails while12// choosing between an operator function template and an operator function.13constexpr auto r = &S1::operator int;14// expected-error@-1 {{initializer of type '<overloaded function type>'}}15 16 17template <typename T>18struct S2 {19  template <typename U=T>20    S2(U={}) requires (sizeof(T) > 0) {}21    // expected-note@-1 {{candidate constructor}}22 23  template <typename U=T>24    S2(U={}) requires (true) {}25    // expected-note@-1 {{candidate constructor}}26};27 28S2<int> s;  // expected-error {{call to constructor of 'S2<int>' is ambiguous}}29