[llvm-bugs] [Bug 24921] New: Specializing template methods with enum parameters not working in 3.7

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 24 02:06:50 PDT 2015


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

            Bug ID: 24921
           Summary: Specializing template methods with enum parameters not
                    working in 3.7
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: maxime.van.noppen at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following code does not compile on clang 3.7 but works on clang 3.6 and
various versions of gcc.

-----
enum EnumType { A };
class MyClass
{
  template<int I> inline void set(int v);
  template<EnumType P> inline void set(int v, int I);
};
template<> void MyClass::set<A>(int v, int I) { }
-----

Fails with the error:

error: no function template matches function template specialization 'set'
template<> void MyClass::set<A>(int v, int I) { }
5 : note: candidate template ignored: could not match 'void (int)' against
'void (int, int)'
template<int I> inline void set(int v);
7 : note: candidate template ignored: invalid explicitly-specified argument for
template parameter 'P'
template<EnumType P> inline void set(int v, int I);


Swapping the declaration order of the methods in the classes makes the code
compile, as well as using an enum class.

-- 
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/20150924/64d67b10/attachment.html>


More information about the llvm-bugs mailing list