[llvm-bugs] [Bug 27457] New: Possible regression: "invalid explicitly-specified argument" on enum value as template parameter

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 21 14:44:11 PDT 2016


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

            Bug ID: 27457
           Summary: Possible regression: "invalid explicitly-specified
                    argument" on enum value as template parameter
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: trprince at synopsys.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org,
                    sig-rnd-sat-clang-bugs at synopsys.com
    Classification: Unclassified

Some time prior to clang 3.6.2, clang accepted the following snippet, but now
rejects it:

$ cat t.cpp
enum MyEnum { e };
class A {};
template <MyEnum> void foo(A) { }
#ifndef HIDE
template <int> void foo(int) {  }
#endif
void bar() { foo<e>(A()); }
$

Clang 3.5:

$ clang-3.5 -v
clang version 3.5.2 (tags/RELEASE_352/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$ clang-3.5 -c t.cpp
$

Clang 3.6:

$ clang-3.6 -v
clang version 3.6.2 (tags/RELEASE_362/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$ clang-3.6 -c t.cpp
t.cpp:7:14: error: no matching function for call to 'foo'
void bar() { foo<e>(A()); }
             ^~~~~~
t.cpp:5:21: note: candidate function [with $0 = 0] not viable: no known
conversion from 'A' to 'int' for 1st argument
template <int> void foo(int) {  }
                    ^
t.cpp:3:24: note: candidate template ignored: invalid explicitly-specified
argument for 1st template parameter
template <MyEnum> void foo(A) { }
                       ^
1 error generated.
$

When the second template is omitted, both clang versions accept the snippet:
$ clang-3.5 -DHIDE -c t.cpp
$ clang-3.6 -DHIDE -c t.cpp
$

I can reproduce this with a recent svn build as well.

-- 
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/20160421/702616d5/attachment-0001.html>


More information about the llvm-bugs mailing list