[llvm-bugs] [Bug 38299] New: non-dependent name treated as if it were dependent, requiring use of template keyword

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 24 17:45:14 PDT 2018


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

            Bug ID: 38299
           Summary: non-dependent name treated as if it were dependent,
                    requiring use of template keyword
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

This example fails to compile on the marked line, but nothing here is
dependent. 


struct X { 
    template <class T>
    void foo();
};

struct Base {
    X get();
};

template <class >
struct Derived : Base
{
    void foo() {
        auto result = Base::get();
        result.foo<void>(); // (*)
    }   
};

template struct Derived<int>;

The error message is:

error: use 'template' keyword to treat 'foo' as a dependent template name
     result.foo<void>(); // (*)
            ^
            template 
    1 error generated.

BTW, g++ accepts the code.

-- 
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/20180725/49a95126/attachment.html>


More information about the llvm-bugs mailing list