[cfe-dev] Specializing template methods with enum parameters not working in 3.7

Maxime van Noppen via cfe-dev cfe-dev at lists.llvm.org
Tue Sep 22 07:24:25 PDT 2015


Hi guys,

I couldn't find any bug filed related to this issue so I'm asking before
creating one. This snippet of code worked in clang 3.6 and in all gcc
versions I could try but stopped working in clang 3.7.

-----
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) { }
-----

The error is:
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);



Link to gcc.godbolt.org: https://goo.gl/BbWVQw


The same code using an "enum class" and qualifying the enum constant
(EnumType::A) in the specialization works though: https://goo.gl/Kix3hq


Does this look like a clang bug or is it not standard just happened to work
before?


Thanks,

-- 
Maxime
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150922/4ecf7c09/attachment.html>


More information about the cfe-dev mailing list