https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69260
Bug ID: 69260
Summary: C++14 template instantiation problem in GCC (up to
5.3)
Product: gcc
Version: 5.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: wuyongwei at gmail dot com
Target Milestone: ---
Created attachment 37328
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37328&action=edit
Test code to show the problem.
The attached C++14 template code does not work in GCC 4.9 to 5.3, unless one
uncomments the first line in main to have an explicit instantiation. The
explicit instantiation is not needed in Clang.
I cannot find any reason why an explicit instantiation is needed.
The error message in GCC 5.3 is:
test.cpp: In function 'int main()':
test.cpp:19:43: error: conversion from '<unresolved overloaded function type>'
to non-scalar type 'std::function<int(int, int, int)>' requested
std::function<int(int, int, int)> f = sum<int, int, int>;
^