[LLVMbugs] [Bug 23050] New: error: cannot compile this weird std::initializer_list yet on variadic initialization

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 27 17:25:26 PDT 2015


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

            Bug ID: 23050
           Summary: error: cannot compile this weird std::initializer_list
                    yet on variadic initialization
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eliben at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This code:

    namespace std
    {
      typedef unsigned long size_t;
      template<class _E>
        class initializer_list
        {
        public:
          typedef _E value_type;
          typedef const _E& reference;
          typedef const _E& const_reference;
          typedef size_t size_type;
          typedef const _E* iterator;
          typedef const _E* const_iterator;

        private:
          iterator _M_array;
          size_type _M_len;

          constexpr initializer_list(const_iterator __a, size_type __l)
          : _M_array(__a), _M_len(__l) { }

        public:
          constexpr initializer_list() noexcept
          : _M_array(0), _M_len(0) { }
        };
    }

    template <typename T, std::size_t n>
    class array {
     public:
      array(std::initializer_list<T> l) {}
    };

    template <typename Ty>
    struct KKK {
      template<typename... Tys>
      void foo(Ty first, Tys... others) {
        const std::size_t NumTys = sizeof...(others) + 1;
        array<Ty, NumTys> dims = {first, others...};
      }
    };


    void  moo() {
      KKK<int> blob;
      blob.foo(10, 20, 30, 40);
    }

Compiled with upstream Clang (ToT):

$ clang++ -cc1 -x cuda -std=gnu++11     -triple nvptx64-unknown-unknown 
-emit-llvm     -o /dev/null ~/test/variadictest.cc

test/variadictest.cc:39:30: error: cannot compile this weird
std::initializer_list yet
    array<Ty, NumTys> dims = {first, others...};
                             ^~~~~~~~~~~~~~~~~~
1 error generated.

-- 
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/20150328/de072602/attachment.html>


More information about the llvm-bugs mailing list