User account creation filtered due to spam.

Bug 36002 - Error messages report wrong, invalid function type.
Summary: Error messages report wrong, invalid function type.
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: diagnostic
Depends on:
Reported: 2008-04-21 21:07 UTC by Eelis
Modified: 2009-12-26 18:20 UTC (History)
2 users (show)

See Also:
Known to work: 4.4.0 4.5.0
Known to fail: 4.3.3
Last reconfirmed: 2008-12-28 06:38:36


Note You need to log in before you can comment on or make changes to this bug.
Description Eelis 2008-04-21 21:07:49 UTC
Consider the following invalid code:

  template <typename T> void f() { T::bla; }
  void g() { f<void ()>(); }

g++ emits:

  t.cpp: In function ‘void f() [with T = void ()()]’:
  t.cpp:2:   instantiated from here
  t.cpp:1: error: ‘bla’ is not a member of ‘void ()()’

The error should say "void ()", not "void ()()". The latter is not even a valid C++ type, as can be seen by doing:

  template <typename T> void f();
  void g() { f<void()()>(); }

resulting in:
  error: ‘type name’ declared as function returning a function
Comment 1 Andrew Pinski 2008-05-05 05:20:21 UTC
Comment 2 Paolo Carlini 2009-12-26 18:20:25 UTC
The error message is fine in the released 4.4.0, not a regression, closing.