[Bug c++/84981] C++17 allows function pointers with no linkage as template parameters but gcc errors, stating the function has no linkage
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 19 23:20:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84981
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
And maybe also this for references as template arguments:
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6259,7 +6259,8 @@ convert_nontype_argument_function (tree type, tree expr,
}
linkage = decl_linkage (fn_no_ptr);
- if (cxx_dialect >= cxx11 ? linkage == lk_none : linkage != lk_external)
+ if ((cxx_dialect < cxx11 && linkage != lk_external)
+ || (cxx_dialect < cxx17 && linkage == lk_none))
{
if (complain & tf_error)
{
But I think there's more needed to ensure we don't produce invalid GIMPLE.
More information about the Gcc-bugs
mailing list