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: unassignedclangb...@nondot.org
          Reporter: raff...@casagrande.ch
                CC: dgre...@apple.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to