[LLVMbugs] [Bug 17401] New: Incorrect dependent template name error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Sep 28 18:21:10 PDT 2013


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

            Bug ID: 17401
           Summary: Incorrect dependent template name error
           Product: clang
           Version: 3.3
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: temporal at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In the code shown below, Clang claims that the call to `foo` within `C::baz()`
is template-dependent and therefore must be prefixed with the `template`
keyword.  I'm not a standards expert, but it does not appear to me to be
template-dependent -- the call clearly always resolves to `A::foo()`. 
Moreover, if the type of `C::b` is changed to `B*` and the call becomes
`b->bar().foo<T>()` then no error is reported, which seems pretty suspicious.

Tested on Clang 3.2 (Ubuntu) and Clang 3.3 (Xcode 5).

G++ (4.7, 4.8) does not report an error on this code.

$ cat test.c++
class A {
public:
  template <typename T>
  T foo();
};

class B {
public:
  A bar();
};

template <typename T>
class C {
public:
  T baz() {
    return b.bar().foo<T>();
  }

private:
  B b;
};
$ clang++ -c test.c++
test.c++:16:20: error: use 'template' keyword to treat 'foo' as a dependent
template name
    return b.bar().foo<T>();
                   ^
                   template 
1 error generated.
$

-- 
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/20130929/e61b8f5e/attachment.html>


More information about the llvm-bugs mailing list