-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] check deduction consistency when partial ordering function te…
…mplates This makes partial ordering of function templates consistent with other entities. Fixes #18291
- Loading branch information
Showing
12 changed files
with
726 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// RUN: %clang_cc1 -std=c++23 -verify %s | ||
|
||
namespace t1 { | ||
template<bool> struct enable_if { typedef void type; }; | ||
template <class T> class Foo {}; | ||
template <class X> constexpr bool check() { return true; } | ||
template <class X, class Enable = void> struct Bar {}; | ||
|
||
template<class X> void func(Bar<X, typename enable_if<check<X>()>::type>) {} | ||
// expected-note@-1 {{candidate function}} | ||
|
||
template<class T> void func(Bar<Foo<T>>) {} | ||
// expected-note@-1 {{candidate function}} | ||
|
||
void g() { | ||
func(Bar<Foo<int>>()); // expected-error {{call to 'func' is ambiguous}} | ||
} | ||
} // namespace t1 | ||
|
||
namespace t2 { | ||
template <bool> struct enable_if; | ||
template <> struct enable_if<true> { | ||
typedef int type; | ||
}; | ||
struct pair { | ||
template <int = 0> pair(int); | ||
template <class _U2, enable_if<__is_constructible(int &, _U2)>::type = 0> | ||
pair(_U2 &&); | ||
}; | ||
int test_test_i; | ||
void test() { pair{test_test_i}; } | ||
} // namespace t2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.