[llvm-bugs] [Bug 42341] New: Clang incorrectly rejects local variable of template class in template functions

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 20 04:49:57 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: anastasia.stulova at arm.com
                CC: anastasia.stulova at arm.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190620/74176a7e/attachment.html>


More information about the llvm-bugs mailing list