[llvm-bugs] [Bug 27544] New: defined template friend is 'sometimes' not defined - std::experimental::any

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 27 11:57:22 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27544

            Bug ID: 27544
           Summary: defined template friend is 'sometimes' not defined -
                    std::experimental::any
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eyenseo at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16276
  --> https://llvm.org/bugs/attachment.cgi?id=16276&action=edit
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! :)

-- 
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/20160427/16556112/attachment.html>


More information about the llvm-bugs mailing list