https://bugs.llvm.org/show_bug.cgi?id=49472
Bug ID: 49472
Summary: "friend Foo< args >;" sometimes gives friendship to
other template instances
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: j...@arista.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
Given the following program [https://godbolt.org/z/c9Y895]:
#include <type_traits>
template< bool isFriend >
class Tester {
public:
template< typename T, typename = void >
struct IsAccessible : public std::false_type {};
template< typename T >
struct IsAccessible< T, decltype( std::declval< T >().f() ) > : public
std::true_type {};
};
class Foo {
friend Tester< true >;
void f() const;
};
static_assert( !Tester< false >::IsAccessible< Foo >::value );
static_assert( Tester< true >::IsAccessible< Foo >::value );
the first static_assert fails (with clang trunk), even though Tester< false >
isn't a friend of Foo, and therefore the partial specialization of IsAccessible
shouldn't be used for Tester< false >::IsAccessible< Foo >.
Note that this program works correctly in g++ (trunk), MSVC and ICC.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs