[Bug c++/66766] New: Reference to an “auto” function as a template parameter
quentin.c.diaz at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Jul 4 21:04:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66766
Bug ID: 66766
Summary: Reference to an “auto” function as a template
parameter
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: quentin.c.diaz at gmail dot com
Target Milestone: ---
The following code :
template <void (&a)()>
struct Foo {
static auto value() {}
};
void bar() {}
template struct Foo<Foo<bar>::value>;
Causes the following error :
error: could not convert template argument ‘Foo<a>::value<bar>’ to ‘void (&)()’
template struct Foo<Foo<bar>::value>;
^
Any of the following makes it compile successfully :
- Declaring value() as returning void instead of deducing it
- "Dereferencing" value : template struct Foo<*Foo<bar>::value>;
- Parenthesizing value : template struct Foo<(Foo<bar>::value)>;
- Making a a pointer : template <void (*a)()> struct Foo ...
More information about the Gcc-bugs
mailing list