Bug 36002 - Error messages report wrong, invalid function type.
Summary: Error messages report wrong, invalid function type.
Status: RESOLVED WORKSFORME
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
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2008-04-21 21:07 UTC by Eelis
Modified: 2009-12-26 18:20 UTC (History)
2 users (show)

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


Attachments

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
Confirmed.
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.