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

Reply via email to