[LLVMbugs] [Bug 22247] New: use 'template' keyword to treat 'get' as a dependent template name [fails if get<>() is called via array: a[0].get<>(), otherwise works: b.get<>()]

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 16 01:20:16 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22247

            Bug ID: 22247
           Summary: use 'template' keyword to treat 'get' as a dependent
                    template name [fails if get<>() is called via array:
                    a[0].get<>(), otherwise works: b.get<>()]
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david.abdurachmanov at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Reduced and discussed testcase at #llvm

class foo {
    public:
    template<typename T> T get() const;
};

template <class T>
class bar {
  private:
    foo x;
    foo y[1];
  public:
    bar() {
    x.get<int>(); // ok
    y[0].get<int>(); // error?!
    }
};

prog.cc:15:10: error: use 'template' keyword to treat 'get' as a dependent
template name y[0].get<int>(); // error?! ^ template 1 error generated.

get<>() is not dependent on template parameters. The compiler treats get<>()
unfairly if it's called via array, otherwise works just fine.

I assume some internal check if Clang does not catch/match all options.

C++ 14.2/4 only lists examples where a method call is directly dependent on
template parameters. In that case using "template" keyword is required. In this
testcase get<>() is not dependent on class template parameters.

-- 
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/20150116/60d1db0a/attachment.html>


More information about the llvm-bugs mailing list