[llvm-bugs] [Bug 37617] New: Some casts to base class conversion are listed for overload resolution& template parameter deduction even though they are inaccessible
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue May 29 05:42:42 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37617
Bug ID: 37617
Summary: Some casts to base class conversion are listed for
overload resolution& template parameter deduction
even though they are inaccessible
Product: clang
Version: 6.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: janos.boudet at nerd.nintendo.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
//The bug happens since 3.9.0 until at least 6.0.0
//declaration
template<typename... Ts> class A;
//specialization for > 0 params
template<typename T0, typename... Ts>
class A<T0, Ts...> : private A<Ts...>{};
//specialization for 0 params
template<> class A<>{};
template<typename... Ts>
void foo(A<Ts...> const&);
class B : public A<int, float>{};
int main() {
B b;
foo(b);
//it seems that there's an (erroneous?) ambiguity between
//1. foo(A<int, float>)
//2. foo(A<float>)
//3. foo(A<>)
//I expected 2 and 3 to be ignored (inaccessible), because they
//would require a reference cast to a privately inherited base type,
//and thus 1 be the only choice, with no ambiguity
//
//removing the inheritance in the >0 param specialization of A removes
//the error
return 0;
}
// compiler error clang 6.0.0
// <source>:19:5: error: no matching function for call to 'foo'
//
// foo(b);
//
// ^~~
//
// <source>:12:6: note: candidate template ignored: failed template argument
deduction
//
//void foo(A<Ts...> const&);
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180529/ab66531e/attachment.html>
More information about the llvm-bugs
mailing list