Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313982

Summary: content assist not working inside placement new
Product: [Tools] CDT Reporter: Mike Kucera <mikekucera>
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Mike Kucera <mikekucera>
Severity: normal    
Priority: P3 CC: john_ws_liu
Version: 6.0.2   
Target Milestone: 7.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
testcase + fix
mschorn.eclipse: iplog-
improved patch and additional testcases mschorn.eclipse: iplog-

Description Mike Kucera CLA 2010-05-21 17:19:18 EDT
struct A {
   int a;
};

struct B {
   int b;
};

int foo() {
   B * b = new B();
   A * a = new (b-><ctrl-space>) A();
}

No proposals, expecting b to be proposed.

This contrived example shows that content assist does not work inside placement new syntax.
Comment 1 Markus Schorn CLA 2010-08-06 05:07:05 EDT
Created attachment 176010 [details]
testcase + fix
Comment 2 Markus Schorn CLA 2010-08-06 07:07:46 EDT
Created attachment 176020 [details]
improved patch and additional testcases
Comment 3 Markus Schorn CLA 2010-08-06 07:12:57 EDT
Fixed in 7.0.1 and 8.0 > 20100806.
Comment 5 John Liu CLA 2010-08-11 15:22:41 EDT
(In reply to comment #2)
> Created an attachment (id=176020) [details]
> improved patch and additional testcases

hi, Markus:
Should the test code for Bug313982b be 

        //	struct B {
	//		int m;
	//	};
	//	int foo() {
	//		B * b;
	//		new (b->m) 

and for Bug313982c be:

	//	struct B {
	//		int m;
	//	};
	//	int foo() {
	//		B * b;
	//		new (b->m)

Like no B at the end, I am sure how the offset is calculated in the completion parsing test, just wondering if it should not include the expected proposal code.
Comment 6 John Liu CLA 2010-08-11 15:24:42 EDT
(In reply to comment #5)
> (In reply to comment #2)
> > Created an attachment (id=176020) [details] [details]
> > improved patch and additional testcases
> hi, Markus:
> Should the test code for Bug313982b be 
>         //    struct B {
>     //        int m;
>     //    };
>     //    int foo() {
>     //        B * b;
>     //        new (b->m) 
> and for Bug313982c be:
>     //    struct B {
>     //        int m;
>     //    };
>     //    int foo() {
>     //        B * b;
>     //        new (b->m)
> Like no B at the end, I am sure how the offset is calculated in the completion
> parsing test, just wondering if it should not include the expected proposal
> code.

Sorry copy the same code twice, should the test code for Bug313982c be:

//	struct B {
	//		int m;
	//	};
	//	int foo() {
	//		B * b;
	//		new (b->m) (
Comment 7 John Liu CLA 2010-08-11 15:28:12 EDT
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #2)
> > > Created an attachment (id=176020) [details] [details] [details]
> > > improved patch and additional testcases
> > hi, Markus:
> > Should the test code for Bug313982b be 
> >         //    struct B {
> >     //        int m;
> >     //    };
> >     //    int foo() {
> >     //        B * b;
> >     //        new (b->m) 
> > and for Bug313982c be:
> >     //    struct B {
> >     //        int m;
> >     //    };
> >     //    int foo() {
> >     //        B * b;
> >     //        new (b->m)
> > Like no B at the end, I am sure how the offset is calculated in the completion
> > parsing test, just wondering if it should not include the expected proposal
> > code.
> Sorry copy the same code twice, should the test code for Bug313982c be:
> //    struct B {
>     //        int m;
>     //    };
>     //    int foo() {
>     //        B * b;
>     //        new (b->m) (

Err.. I meant I am NOT* sure how the offset is calculated in the completion
parsing test, so wondering if the test code should not include the expected proposal code.
Comment 8 Markus Schorn CLA 2010-08-12 04:38:47 EDT
The testcases simulate content-assist invoked after the last character of the
provided source. In testcase b and c I provided the prefix 'B' in the code because otherwise all global types would be proposed, including some builtin types that depend on the parser configuration.