<html>
    <head>
      <base href="https://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 --- - defined template friend is 'sometimes' not defined - std::experimental::any"
   href="https://llvm.org/bugs/show_bug.cgi?id=27544">27544</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>defined template friend is 'sometimes' not defined - std::experimental::any
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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++11
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16276" name="attach_16276" title="Minimal broken example">attachment 16276</a> <a href="attachment.cgi?id=16276&action=edit" title="Minimal broken example">[details]</a></span>
Minimal broken example

Hello,

Today I tried clang 3.7.1 and 3.9.0 (trunk) with the std::experimental::any
implementation. I reduced the bug to the following (also attached):

class foo {
public:
  template <typename T>
  friend void gun(foo&) {
  }
  template <typename T>
  friend void gun2(foo&) {
  }
};
// error: redefinition of 'gun'
// template <typename T>
// void gun(foo&) {
// }
// error: redefinition of 'gun2'
// template <typename T>
// void gun2(foo&) {
// }

template <typename T>
void fun() noexcept {
  foo f;

  // no template named 'gun'; did you mean 'fun'?
  gun<T>(f);
  // error: no template named 'gun2'; did you mean 'gun'?
  // 'T' does not refer to a value
  gun2<T>(f);
}

int main(int, char const* []) {
  fun<void>();
  return 0;
}


In the case of std::experimental::any fun is any_cast and gun is __any_cast.
The headers of gcc 5.3.0 were used -- gcc has no problems with the code above.


I hope I got all the information you'll need to figure out this strange bug.

Thank you for your hard work! :)</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>