[llvm-bugs] [Bug 35866] New: Strange compiler error about the subsequent template parameter when a std::size_t template parameter becomes negative

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 8 18:56:09 PST 2018


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

            Bug ID: 35866
           Summary: Strange compiler error about the subsequent template
                    parameter when a std::size_t template parameter
                    becomes negative
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: xaxxon at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Strange compiler error about the subsequent template parameter when a
std::size_t template parameter becomes negative

https://godbolt.org/g/TJRJYK


#include <type_traits>
#include <tuple>

struct C2 {
    template<int default_arg_position = -1, class DefaultArgsTuple =
std::tuple<>>
    int operator()(){return 5;}
};

template<class... Ts>
void stuff(Ts&&...) {}

struct C1 {

    template<std::size_t... ArgIndexes>
    void operator()() {
        constexpr int i = 1;                 // <=== THIS LINE
        // constexpr int i = 0; // works OK 
        stuff(
        C2{}.operator()<ArgIndexes - i>()...
        );
    }
};

int main() {
    C1{}.operator()<0>();
}

-- 
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/20180109/61a088e7/attachment.html>


More information about the llvm-bugs mailing list