[LLVMbugs] [Bug 18043] New: constexpr function pointers aren't considered valid template arguments (violates [temp.arg.nontype])

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Nov 23 21:43:05 PST 2013


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

            Bug ID: 18043
           Summary: constexpr function pointers aren't considered valid
                    template arguments (violates [temp.arg.nontype])
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: oneill+llvmbugs at cs.hmc.edu
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11598
  --> http://llvm.org/bugs/attachment.cgi?id=11598&action=edit
Could that should compile, and doesn't.

clang++ (3.3 through r195314) considers the attached code buggy, producing the
error

buglet.cpp:16:5: error: no matching function for call to 'bar'
    bar<fooAddr>();
    ^~~~~~~~~~~~
buglet.cpp:6:6: note: candidate template ignored: invalid explicitly-specified
      argument for template parameter 'f'
void bar()
     ^
gcc 4.6 through 4.8 consider it valid, and my reading of the C++11 standard,
14.3.2 Template non-type arguments [temp.arg.nontype], indicates that the code
should be allowed, as it says:

"a constant expression (5.19) that designates the address of an object with
static storage duration and external or internal linkage or a function with
external or internal linkage, including function templates and function
template-ids but excluding non-static class members, expressed (ignoring
parentheses) as & id-expression, except that the & may be omitted if the name
refers to a function or array and shall be omitted if the corresponding
template-parameter is a reference;"

-- 
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/20131124/0c6cd099/attachment.html>


More information about the llvm-bugs mailing list