[cfe-dev] Clang++ -Wambiguous-member-template, zealous or legitimate?

Grégory Pakosz gregory.pakosz at gmail.com
Mon Oct 6 01:58:47 PDT 2014


Hello,

Folks on OFTC #llvm channel suggested I post to this mailing list about the
following snippet (http://goo.gl/fayMFH):

struct A
{
  template<typename T>
  A& B() { return *this; }
};

template<typename T>
struct B
{
};

int main()
{
  A().B<int>();
  return 0;
}

Clang++ emits the following warning:

14 : warning: lookup of 'B' in member access expression is ambiguous; using
member of 'A' [-Wambiguous-member-template]

I had the impression there's no ambiguity: in that case, it must be the
member function call.

Am I right to believe Clang++ emits a warning erroneously?

Regards,
Gregory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141006/08a8e79c/attachment.html>


More information about the cfe-dev mailing list