<p>This is regarding a test case which involves default argument
deduction/substitution. The test case can be summarized as :</p>
<p><br>template <class T, class = typename T::I>h(T){}</p>
<p>template <class T, class = typename T::I>j(T){}</p>
<p>class A<br>{<br> typedef int I;<br> friend void h<A>(A);<br> <br>};</p>
<p>int main()<br>{<br> A a;<br> h(a);<br> j(a);<br>}</p>
<p>gcc-4.8.1 throws error for function j, since it has been not been declared
friend nor it is private to class A and hence violates access rule for </p>
<p>private member I(which is valid). gcc does not throw error for function h
since it has been declared as friend to class A and hence can access </p>
<p>private member I.</p>
<p>Clang throws error for both the functions. Error for function j (not declared
friend is valid and as expected), but it throws error even for </p>
<p>friend function h (error : deduction of default arg failed since I is a
private member of class A). This violates the accessibility of the friend </p>
<p>function.</p>
<p>The standard says - (At 14.8.2 pt 8)</p>
<p><br>"If a substitution results in an invalid type or expression, type
deduction fails. An in valid type or expression</p>
<p>is one that would be ill-formed if written using the substituted arguments. [
Note: Access checking is done as</p>
<p>part of the substitution process. —end note ]"</p>
<p><br>Can someone please provide inputs as to how to check where the access
rights are being checked in clang? I am using QT creator to debug clang <br clear="all"><br>-- <br>With regards,<br>Suyog <br>
</p>