[llvm-bugs] [Bug 37829] New: References to functions as non-type template args

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 18 01:11:41 PDT 2018


            Bug ID: 37829
           Summary: References to functions as non-type template args
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Clang++ compiles the following code without any error messages:

#include <utility>
#include <iostream>

using namespace std;

template <typename _T, _T _V>
        void foo()
                cout << __PRETTY_FUNCTION__ << endl;

int a = 0;

int b() { cout << __PRETTY_FUNCTION__ << endl; }

int main()
        foo<int, 9>();
        foo<int (), b>();

In the contrast, gcc produces the following error message:
‘int()’ is not a valid type for a template non-type parameter foo<int (), b>();

A bug report of gcc (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=6030)
discusses more details of this issue. 
Shall clang also fix the problem?

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/20180618/32904277/attachment.html>

More information about the llvm-bugs mailing list