[llvm-bugs] [Bug 35971] Compilation error when casting an explicit template argument which is a member-function

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 16 11:36:37 PST 2018


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
                 CC|                            |richard-llvm at metafoo.co.uk
             Status|NEW                         |RESOLVED

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
(In reply to Borislav Stanimirov from comment #0)
> Both examples compile fine on gcc and msvc

That is a bug in those compilers. The C++11 and C++14 rules are quite clear
about the permitted syntactic forms of non-type template arguments.
[temp.arg.nontype]/1.3 says the argument shall be:

  "[...] a pointer to member expressed as described in [expr.unary.op]"

GCC does correctly implement the rule for the non-pointer-to-member case:

  https://godbolt.org/g/jb6gwU

... strongly suggesting that this is just an oversight on their part. (MSVC has
apparently never followed the rules here.)

The rule in question was changed in C++17 to allow arbitrary constant
expressions of the right type as non-type template arguments:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4198.html

-- 
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/20180116/af3190a6/attachment.html>


More information about the llvm-bugs mailing list