Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362976 - Assignment in if statement parsed incorrectly
Summary: Assignment in if statement parsed incorrectly
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 8.0.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.1.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
: 353265 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-11-05 23:27 EDT by Nathan Ridge CLA
Modified: 2016-12-22 18:49 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Ridge CLA 2011-11-05 23:27:44 EDT
An assignment inside an if statement seems to be parsed incorrectly when the right-hand side of the assignment is a call to a template function, and the if statement itself occurs in a template function:

template <int>
void* foo(int);

template <typename T>
void f(T t)
{
    if (T* i = foo<0>(0))  // ERROR HERE
        return 0;
}

The error on the indicated line is:

"Symbol 'i' could not be resolved"

The code compiles just fine with GCC.
Comment 1 Markus Schorn CLA 2011-11-07 09:01:36 EST
Thanks! Added testcase and fix.
Comment 2 CDT Genie CLA 2011-11-07 09:23:03 EST
*** cdt git genie on behalf of Markus Schorn ***

    Bug 362976: Directly nested ambiguity node.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=0ebca71a1d033d48e706a847f113a4c8c86951de
Comment 3 Nathan Ridge CLA 2016-12-22 18:49:41 EST
*** Bug 353265 has been marked as a duplicate of this bug. ***