-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
private member function in the template specialization does not sfinae out overload #68849
Comments
@llvm/issue-subscribers-clang-frontend Author: Kefu Chai (tchaikov)
i notice that following program fails to compile:
```c++
template <typename> struct templ_foo;
template <> class templ_foo<int> { template <typename> struct templ_bar; template <> class templ_bar<bool> { template <class U> void parse_format_specs() { #define GLOBAL_OVERLOAD 0 #if GLOBAL_OVERLOAD
but if i #define GLOBAL_OVERLOAD 1 the source code compiles. the same source code compiles with gcc 13.2.1 with my guess is that clang fails to take the member access check into consideration if the member is accessed by the template specialization of the same template. in this case, both full specialization specialize the template of the reproducer is also available at godbolt. see https://godbolt.org/z/EW6EPPqz3 |
fmt 10 detects if a formatter provides some method (set_debug_format()), but the detection fails if the method is private and compilation breaks on clang [1]. Work around the clang bug by inheriting publicly. [1] llvm/llvm-project#68849 A test case reproducing the problem is included (thanks Kefu Chai <[email protected]>).
fmt 10 detects if a formatter provides some method (set_debug_format()), but the detection fails if the method is private and compilation breaks on clang [1]. Work around the clang bug by inheriting publicly. [1] llvm/llvm-project#68849 A test case reproducing the problem is included (thanks Kefu Chai <[email protected]>).
fmt 10 detects if a formatter provides some method (set_debug_format()), but the detection fails if the method is private and compilation breaks on clang [1]. Work around the clang bug by inheriting publicly. [1] llvm/llvm-project#68849 A test case reproducing the problem is included (thanks Kefu Chai <[email protected]>).
fmt 10 detects if a formatter provides some method (set_debug_format()), but the detection fails if the method is private and compilation breaks on clang [1]. Work around the clang bug by inheriting publicly. [1] llvm/llvm-project#68849 A test case reproducing the problem is included (thanks Kefu Chai <[email protected]>). Closes #1855
I will take a look at this. Thank @SuperSodaSea for providing a minimal reproducer. |
fmt 10 detects if a formatter provides some method (set_debug_format()), but the detection fails if the method is private and compilation breaks on clang [1]. Work around the clang bug by inheriting publicly. [1] llvm/llvm-project#68849 A test case reproducing the problem is included (thanks Kefu Chai <[email protected]>). Closes scylladb#1855
i notice that following program fails to compile:
when i compile it using Clang (tested with clang-16, clang-17 and the latest clang trunk):
but if i
the source code compiles. the same source code compiles with gcc 13.2.1 with
GLOBAL_OVERLOAD
defined to1
or0
.my guess is that clang fails to take the member access check into consideration if the member is accessed by the template specialization of the same template. in this case, both full specializations specialize the template of
templ_foo
withint
andbool
respectively. if i declare another templatetempl_baz
, and specialize it usingbool
, and then define the same overloads in it, clang is able to sfinae out the overload accessing the private member function.the reproducer is also available at godbolt. see https://godbolt.org/z/EW6EPPqz3
EDIT, i changed the code in the description of this issue to match the one in the godbolt. i was experimenting the case where the caller was a specialization of another template.
The text was updated successfully, but these errors were encountered: