Issue 135273
Summary [clang] Inconsistent __is_pointer_interconvertible_base_of results for direct vs. templated calls
Labels clang
Assignees
Reporter romanova-ekaterina
    Consider the following test:

{code:java}
## Source code

#include <iostream>
class A {};
class B : public A {};

template <class _Base, class _Derived>
inline constexpr bool is_pointer_interconvertible_base_of_v = __is_pointer_interconvertible_base_of(_Base, _Derived);

int main() {
    std::cout << __is_pointer_interconvertible_base_of(const A, A) << std::endl;     
    std::cout << is_pointer_interconvertible_base_of_v<const A, A> << std::endl;

    std::cout << __is_pointer_interconvertible_base_of(const A, B) << std::endl;     
    std::cout << is_pointer_interconvertible_base_of_v<const A, B> << std::endl;     
} 

## Observed Result
1
0
1
1 {code}

When calling __is_pointer_interconvertible_base_of(const A, A) directly, the result is 1. It is expected behavior. But, when using the templated version it returns 0. For (const A, B), both returns 1 as expected.

The direct call and the template call to should yield the same result, but they do not. 

X86_64 gcc (version 14.1) shows correct result:

Output:
{code:java}
1
1
1
1 {code}


_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to