<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - default template argument privacy"
   href="http://llvm.org/bugs/show_bug.cgi?id=18079">18079</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>default template argument privacy
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kusmabite@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code does not compile with Clang:

---8<---
template <class Bar, int Bar::*PtrToInt = &Bar::myInt>
class Foo {};

class Bar {
private:
    int myInt;
public:
    void FooBar()
    {
        // does not compile:
        Foo<Bar> test;
        // does compile:
        // Foo<Bar, &Bar::myInt> test;
    }
};
---8<---

Clang errors as follows:

---8<---
clang-issue.cpp:1:49: error: 'myInt' is a private member of 'Bar'
template <class Bar, int Bar::*PtrToInt = &Bar::myInt>
                                                ^
clang-issue.cpp:11:3: note: in instantiation of default argument for 'Foo<Bar>'
required here
                Foo<Bar> test;
                ^~~~~~~~
clang-issue.cpp:6:6: note: declared private here
        int myInt;
            ^
1 error generated.
---8<---

This differs from how both GCC and MSVC handles privacy of default template
arguments: it seems Clang considers privacy in the context of the template
definition in this case, whereas GCC and MSVC considers it at the call-site.

Which is correct? Since Clang differs from the two major implementations, my
guess would be that Clang was in the wrong, but I don't really know how to read
the C++ spec to be sure...</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>