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

            Bug ID: 42341
           Summary: Clang incorrectly rejects local variable of template
                    class in template functions
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: OpenCL
          Assignee: unassignedclangb...@nondot.org
          Reporter: anastasia.stul...@arm.com
                CC: anastasia.stul...@arm.com, llvm-bugs@lists.llvm.org

If we declare a local variable of a template class type inside a function
template, incorrect error is produced.

Example:
template <int N>
struct MyStruct { int x; };

int MyPassingFunc()
{
    MyStruct<5> s;
    return s.x;
}

template <int N>
int AnotherPassingFunc()
{
    __private MyStruct<N> s;
    return s.x;
}

template <int N>
int MyFailingFunc()
{
    MyStruct<N> s; // error: automatic variable qualified with an invalid
address space 
    return s.x;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to