[LLVMbugs] [Bug 22066] New: [ms] Unqualified lookup in dependent classes doesn't work for member template calls with explicit type parameters

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 30 12:59:02 PST 2014


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

            Bug ID: 22066
           Summary: [ms] Unqualified lookup in dependent classes doesn't
                    work for member template calls with explicit type
                    parameters
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This compiles (good):

template<class T> struct Base {
  template<class G> void f(G t) {}
};

template<class T> struct Sub : Base<T> {
  void g() {
    f(4);
  }
};

void foo() {
  Sub<int> i;
  i.g();
}


D:\src\chromefetch\src\out\Release>
"D:\\src\\llvm-ninja-rel64\\bin\\clang-cl.exe" -m32 /c foo.ii
foo.ii(7,5) :  warning: use of identifier 'f' found via unqualified lookup into
dependent bases of class templates is a
      Microsoft extension [-Wmicrosoft]
    f(4);
    ^
    this->


But this doesn't:

template<class T> struct Base {
  template<class G> void f(G t) {}
};

template<class T> struct Sub : Base<T> {
  void g() {
    f<int>(4);
  }
};

void foo() {
  Sub<int> i;
  i.g();
}

D:\src\chromefetch\src\out\Release>
"D:\\src\\llvm-ninja-rel64\\bin\\clang-cl.exe" -m32 /c foo.ii
foo.ii(7,5) :  warning: use of undeclared identifier 'f'; unqualified lookup
into dependent bases of class template 'Sub' is
      a Microsoft extension [-Wmicrosoft]
    f<int>(4);
    ^
    this->
foo.ii(7,10) :  error: expected '(' for function-style cast or type
construction
    f<int>(4);
      ~~~^
1 warning and 1 error generated.



With the `this->`, another warning is emitted:

template<class T> struct Base {
  template<class G> void f(G t) {}
};

template<class T> struct Sub : Base<T> {
  void g() {
    this->f<int>(4);
  }
};

void foo() {
  Sub<int> i;
  i.g();
}

D:\src\chromefetch\src\out\Release>
"D:\\src\\llvm-ninja-rel64\\bin\\clang-cl.exe" -m32 /c foo.ii
foo.ii(7,11) :  warning: use 'template' keyword to treat 'f' as a dependent
template name
    this->f<int>(4);
          ^
          template
1 warning generated.


I guess the fixit recovery we do with the this-> bit isn't applied correctly
with the fixit we do in MS mode for adding the "this->" somehow.

-- 
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/20141230/96a921f4/attachment.html>


More information about the llvm-bugs mailing list