Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314116 - Comparing function types with empty parameter lists
Summary: Comparing function types with empty parameter lists
Status: RESOLVED INVALID
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Mike Kucera CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-24 10:13 EDT by Tom Longridge CLA
Modified: 2010-05-25 04:43 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Longridge CLA 2010-05-24 10:13:36 EDT
Build Identifier: M20100211-1343

When the following function types are compared using CFunctionType's isSameType, they are deemed to be not the same because their parameter lists are different lengths.

void func()
void func(void)

The standard (6.7.5.3) says that the "special case of an unnamed parameter of type void as the only item in the list specifies that the function has no parameters". So I would argue that the implementation of isSameType is incorrect in this case.

Reproducible: Always
Comment 1 Markus Schorn CLA 2010-05-25 04:43:20 EDT
Different to how this works in C++, in C the declaration 'void func()' means that the parameter list is unspecified, which is different from 'void func(void)' meaning that the function has an empty parameter list.

For example:
void f1() {
  f1(1);   // This is ok.
}

void f2(void) {
  f2(1);   // This is a compile error
}