Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 90606 - [IBinding] Problem from sizeof ambiguity
Summary: [IBinding] Problem from sizeof ambiguity
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Andrew Niefer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-07 09:56 EDT by Devin Steffler CLA
Modified: 2005-05-05 14:55 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Steffler CLA 2005-04-07 09:56:53 EDT
// taken from cpp spec 3.3.6-5 example:
	typedef int c;
	enum { i = 1 };
	class X {
	int i=3;
	char v[i];
	int f() { return sizeof(c); } // OK: X::c // invalid ProblemBinding on c
	char c;
	enum { i = 2 };
	};
	typedef char* T;
	struct Y {
	typedef long T;
	T b;
	};
	typedef int I;
	class D {
	typedef I I; // error, even though no reordering involved
	};
Comment 1 Andrew Niefer CLA 2005-04-07 11:09:52 EDT
John: 
This is an ambiguity between 
sizeof unary-expression
sizeof ( type-id )

In this case it is parsed as ( type-id ), and c is not a type, so we generate a
problem.  During the parse, you wouldn't be able to resolve this ambiguity until
the end of the composite type spec, since the c that is found is actually after
the sizeof.

Can we do anything about the ambiguity or should I just relax the type checking
in this case?
Comment 2 John Camelon CLA 2005-05-05 14:55:14 EDT
Fix applied to HEAD.