[llvm-bugs] [Bug 27970] New: Error on SFINAE expression: non-type template argument specializes a template parameter with dependent type.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 1 13:55:24 PDT 2016


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

            Bug ID: 27970
           Summary: Error on SFINAE expression: non-type template argument
                    specializes a template parameter with dependent type.
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: michele.caini at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider the following code:

    #include <type_traits>
    #include <cstddef>

    template<std::size_t N, std::size_t M, std::enable_if_t<not (N>M)>* =
nullptr> // (1)
    struct S: public S<N+1, M> { };

    template<std::size_t N>
    struct S<N, N> { };

    int main() {
        S<0, 1> c{};
    }

It fails to compile with the following error:

    8 : error: non-type template argument specializes a template parameter with
dependent type 'std::enable_if_t<!(N > M)> *' (aka 'typename enable_if<!(N >
M), void>::type *')
    struct S<N, N> { };

The same code works as expected using the following line instead of (1):

    template<std::size_t N, std::size_t M, typename = std::enable_if_t<not
(N>M)>>

-- 
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/20160601/b797f032/attachment.html>


More information about the llvm-bugs mailing list