Skip to content

[SYCL] Explicit fill broken when using nested template types #469

Closed
@j-stephan

Description

@j-stephan

Example code:

#include <CL/sycl.hpp>

template <typename S>
struct parent
{
    template <typename T>
    struct foo
    {
        T val;
    };

    using Mask = foo<bool>;
    int some_val;
};


auto main() -> int
{
    using type = typename parent<int>::Mask;
    auto queue = cl::sycl::queue{cl::sycl::default_selector{}};
    auto buf = cl::sycl::buffer<type>{cl::sycl::range<1>{1024}};

    queue.submit([&](cl::sycl::handler& cgh)
    {
        auto acc = buf.get_access<cl::sycl::access::mode::read_write>(cgh);
        cgh.fill(acc, type{true});
    });
    queue.wait();

    return 0;
}

Command line:

clang++ -std=c++2a -fsycl bool.cpp -ftemplate-backtrace-limit=0 -o bool -lOpenCL

Error message:

In file included from <built-in>:1:
/tmp/bool-29f3c3.h:44:43: error: no member named 'parent' in the global namespace
template <> struct KernelInfo<::__fill< ::parent<int>::foo<_Bool>, 1, cl::sycl::access::mode::read_write, cl::sycl::access::target::global_buffer, cl::sycl::access::placeholder::false_t>> {
                                        ~~^
/tmp/bool-29f3c3.h:44:53: error: expected '(' for function-style cast or type construction
template <> struct KernelInfo<::__fill< ::parent<int>::foo<_Bool>, 1, cl::sycl::access::mode::read_write, cl::sycl::access::target::global_buffer, cl::sycl::access::placeholder::false_t>> {
                                                 ~~~^
/tmp/bool-29f3c3.h:44:60: error: use of undeclared identifier '_Bool'
template <> struct KernelInfo<::__fill< ::parent<int>::foo<_Bool>, 1, cl::sycl::access::mode::read_write, cl::sycl::access::target::global_buffer, cl::sycl::access::placeholder::false_t>> {

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconfirmedenhancementNew feature or requestspec extensionAll issues/PRs related to extensions specifications

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions