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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to