[LLVMbugs] [Bug 21289] New: Unrecognized indirect pack expansion when accessing value member

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 15 11:57:24 PDT 2014


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

            Bug ID: 21289
           Summary: Unrecognized indirect pack expansion when accessing
                    value member
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: juchem at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The parameter packs in the code below are not recognized as unexpanded:
  constant<size_type, 0>::type<Args>::value...
  zero<Args>::value...

Tested in clang 3.4.1 from http://gcc.godbolt.org/ using -std=c++11:
http://goo.gl/R1soR4
It works in gcc 4.7 and up with -std=c++0x/-std=c++11.

-----------

#include <iostream>
#include <tuple>
#include <type_traits>
#include <utility>

template <typename T>
struct fixed {
  template <typename> using type = T;
};

template <typename T>
struct fixed2 {
  template <typename>
  struct with {
    using type = T;
  };
};

template<typename T, T Value>
struct constant {
  template <typename>
  using type = std::integral_constant<T, Value>;
};

using size_type = std::size_t;

template <typename>
using zero = std::integral_constant<size_type, 0>;

template <typename... Args>
bool foo() {
  using tuple = std::tuple<fixed<size_type>::type<Args>..., size_type>;

  tuple t(constant<size_type, 0>::type<Args>::value..., 0);

  return (&t == (tuple*)1);
}

template <typename... Args>
bool bar() {
  using tuple = std::tuple<fixed<size_type>::type<Args>..., size_type>;

  tuple t(zero<Args>::value..., 0);

  return (&t == (tuple*)1);
}

template <typename... Args>
bool baz() {
  using tuple = std::tuple<typename fixed2<size_type>::template
with<Args>::type..., size_type>;

  tuple t(constant<size_type, 0>::type<Args>::value..., 0);

  return (&t == (tuple*)1);
}

int main() {
  std::cout << foo() << std::endl;
  std::cout << foo<int, bool, double>() << std::endl;
  std::cout << bar() << std::endl;
  std::cout << bar<int, bool, double>() << std::endl;
  std::cout << baz() << std::endl;
  std::cout << baz<int, bool, double>() << std::endl;
};

-- 
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/20141015/c308d85a/attachment.html>


More information about the llvm-bugs mailing list