[llvm-bugs] [Bug 39180] Clang compiler failed with error: no matching member function for call to 'f'

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 5 16:30:38 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39180

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
MSVC is wrong to accept this. The instantiation of Tuple_<char, int> looks
approximately like this:

template<> struct Tuple_<char, int> {
  template<char T$1, int T$2> int f() {
    return 2;
  }
};

so f() can only be called with two template arguments.

More formally, the relevant rule is [temp.variadic]/7: "All of the packs
expanded by a pack expansion shall have the same number of arguments
specified."

"Types ...T" is a pack expansion, and the packs "Types" and "T" have different
numbers of arguments, so this code is invalid.

FWIW, EDG also rejects this code, but GCC seems to have a similar bug to MSVC.


If this occurs in a prominent MS header for which compatibility is important,
we can consider adding a workaround to Clang to support that usage; please
reopen in that case.

-- 
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/20181005/65ad583a/attachment.html>


More information about the llvm-bugs mailing list