1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 481078 - Unwrap typedefs when checking for composite pointer

conversion

Change-Id: I70d99f16c32fd2c00971fd20114c45cae3b08785
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
This commit is contained in:
Nathan Ridge 2015-11-12 23:56:11 -05:00 committed by Sergey Prigogin
parent 728a032bde
commit e5d0038f49
2 changed files with 13 additions and 0 deletions

View file

@ -10747,6 +10747,17 @@ public class AST2CPPTests extends AST2TestBase {
public void testBasePointerConverstionInConditional_462705() throws Exception {
parseAndCheckBindings();
}
// struct S {};
// typedef S* S_ptr;
// void waldo(S*);
// S_ptr s;
// int main() {
// waldo(false ? s : 0);
// }
public void testTypedefOfPointerInConditional_481078() throws Exception {
parseAndCheckBindings();
}
// template <bool>
// struct enable_if {

View file

@ -1170,6 +1170,8 @@ public class Conversions {
* the pointer is not possible, the method returns {@code null}.
*/
public static IType compositePointerType(IType t1, IType t2, IASTNode point) {
t1 = SemanticUtil.getNestedType(t1, TDEF);
t2 = SemanticUtil.getNestedType(t2, TDEF);
final boolean isPtr1 = t1 instanceof IPointerType;
if (isPtr1 || isNullPtr(t1)) {
if (isNullPointerConstant(t2)) {