[LLVMbugs] [Bug 22402] New: variable template specialization, lambda and std::tuple

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 30 03:31:49 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22402

            Bug ID: 22402
           Summary: variable template specialization, lambda and
                    std::tuple
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bsun.pku at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The related code is:

```
#include <tuple>
#include <iostream>

template <int I, typename =void>
bool foo;

template <>
auto foo<1, void> = std::make_tuple(1, [](auto){});

template <int I>
auto foo<I, std::enable_if_t<I==2>> = std::make_tuple(I, [](auto){});

auto foo_3 = std::make_tuple(3, [](auto){});
template <int I>
auto foo<I, std::enable_if_t<I==3>> = foo_3;

template <int I>
auto foo<I, std::enable_if_t<I==4>> = std::make_tuple(I);

int main() {
    std::cout << std::get<0>(foo<1>) << std::endl;  // OK, prints 1
    std::cout << std::get<0>(foo<2>) << std::endl;  // ERROR, won't compile
    std::cout << std::get<0>(foo<3>) << std::endl;  // ERROR, prints 0
    std::cout << std::get<0>(foo<4>) << std::endl;  // OK, prints 4
}
```

Am I missing anything here?

-- 
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/20150130/b382a787/attachment.html>


More information about the llvm-bugs mailing list