This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/82773] New: Function-type non-type template parameter not accepted
- From: "support at neoee dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 Oct 2017 19:44:41 +0000
- Subject: [Bug c++/82773] New: Function-type non-type template parameter not accepted
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82773
Bug ID: 82773
Summary: Function-type non-type template parameter not accepted
Product: gcc
Version: 7.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: support at neoee dot net
Target Milestone: ---
When instantiating a C++ function template passing a function-type non-typed
template parameter (e.g. one of type void(int)), the compiler will reject
compilation with the message "error: 'void(int)' is not a valid type for a
template non-type parameter". As far as I can tell, this should flawlessly
work.
void foobar(int);
// decltype(foo) should be evaluating to void (*)(int), acc. to §14.1.8
[temp.param]
template <typename T, T foo>
void bar();
template <auto foo>
void baz();
template <typename T>
struct E {
template <T f>
void bar();
};
int main() {
baz<foobar>(); // ok
E<void (int)>{ }.bar<foobar>(); // ok
bar<void (int), foobar>(); // not ok
}