Summary: | cannot resolve address of function template with empty template argument list | ||
---|---|---|---|
Product: | gcc | Reporter: | kmakaron11 |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | daniel.kruegler |
Priority: | P3 | Keywords: | rejects-valid |
Version: | 4.8.0 | ||
Target Milestone: | 4.8.0 | ||
Host: | Target: | ||
Build: | Known to work: | 4.8.0, 4.9.0 | |
Known to fail: | Last reconfirmed: | 2012-03-29 00:00:00 |
Description
kmakaron11
2012-03-29 12:19:50 UTC
(In reply to comment #0) > The code to explain the problem is: No it isn't, it's missing several include files. I know it's "obvious" which ones they are, but if five different people all look at the bug report and try to reproduce the behaviour then they all have to figure it out and modify the code. You'd save everyone time by providing a *complete* testcase, as clearly requested by the bug submissions guidelines. A complete example would be: template<typename Res> struct function { template<typename F> function(F) { } }; template <class T> struct Creator { template <typename...Ts> static T* create(Ts&&... vs) { return new T(vs...); } }; class Car: public Creator<Car> { private: friend class Creator<Car>; Car() { } }; int main() { function< Car* () > createFn=&Car::create<>; } Same problem using a default template argument instead of a parameter pack: template<typename Res> struct function { template<typename F> function(F) { } }; template <class T> struct Creator { template <typename Ts = int> static T* create(Ts vs) { return new T(vs); } }; class Car: public Creator<Car> { private: friend class Creator<Car>; Car(int) { } }; int main() { function< Car* () > createFn=&Car::create<>; } (technically this is a C++11 bug, but G++ supports variadic templates and default template arguments for functions in c++98 mode) I am sorry, Jonathan Wakely. This is my first GCC bug report. Next time I will, try to put the fallout to minimum. Even more reason to read http://gcc.gnu.org/bugs/ first then :) This is fixed in 4.8.0. |