Debian Codegraph @

clang/test/SemaCXX/PR98671.cpp

raw
1 // RUN: %clang_cc1 -std=c++20 -fsyntax-only %s -verify
2
3 struct 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 while
12 // choosing between an operator function template and an operator function.
13 constexpr auto r = &S1::operator int;
14 // expected-error@-1 {{initializer of type '<overloaded function type>'}}
15
16
17 template <typename T>
18 struct 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
28 S2<int> s; // expected-error {{call to constructor of 'S2<int>' is ambiguous}}