<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - "dynamic initialization is not supported" when compiling CUDA + Thrust code"
   href="https://bugs.llvm.org/show_bug.cgi?id=44803">44803</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"dynamic initialization is not supported" when compiling CUDA + Thrust code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>CUDA
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>daniel.jasinski@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When compiling the following piece of code with on Windows:

```

#include <thrust/device_vector.h>
#include <thrust/transform.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/copy.h>

using namespace thrust;

int main()
{
    int size = 100;
    device_vector<int> v(100);

    auto counter = make_counting_iterator(0);
    copy(counter, counter + size, v.begin());

    auto multiply = [] __host__ __device__ (const int&x){ return x * x;};
    transform(v.begin(), v.end(), v.begin(), multiply);
}

```

I get the following series of errors:

```

thrust/functional.h:1452:74: error: dynamic initialization is not supported for
__device__, __constant__, and __shared__ variables.
static const __device__ thrust::detail::functional::placeholder<0>::type _1;
thrust/functional.h:1461:74: error: dynamic initialization is not supported for
__device__, __constant__, and __shared__ variables.
static const __device__ thrust::detail::functional::placeholder<1>::type _2;

...

thrust/functional.h:1533:74: error: dynamic initialization is not supported for
__device__, __constant__, and __shared__ variables.
static const __device__ thrust::detail::functional::placeholder<9>::type _10;

```


I used the latest release of Thrust.
I checked the type being initialized and it looks like it has no data and an
empty constructor.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>