[llvm-bugs] [Bug 26962] New: Default template arguments and friend declarations don't mix

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 16 07:20:31 PDT 2016


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

            Bug ID: 26962
           Summary: Default template arguments and friend declarations
                    don't mix
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: raffael at casagrande.ch
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

This is very funny behavior:
- If I call a function template once everything compiles.
- If I call the same function template in exactly the same way twice, clang
does not compile it.

Here's a very small code sample that shows the behavior:

#include <memory>

namespace hydi {

      template<int>
      class A
      {
        template<class T>
        friend std::shared_ptr<A<0>> foo();
      };

      template<class T=double>
      std::shared_ptr<A<0>> foo() {}

} // end namespace hydi


int main() {
  *hydi::foo();
  *hydi::foo(); // if this line is commented, everything works!
}



Compile it with: clang++ main.cpp -std=c++11

-- 
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/20160316/37c026c3/attachment.html>


More information about the llvm-bugs mailing list