diff options
Diffstat (limited to 'gcc/cp/pt.c')
| -rw-r--r-- | gcc/cp/pt.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 043e3e467c2..c506609b7f1 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12158,15 +12158,20 @@ resolve_typename_type (tree type, bool only_current_p) tree build_non_dependent_expr (tree expr) { + tree inner_expr; + /* Preserve null pointer constants so that the type of things like "p == 0" where "p" is a pointer can be determined. */ if (null_ptr_cst_p (expr)) return expr; /* Preserve OVERLOADs; the functions must be available to resolve types. */ - if (TREE_CODE (expr) == OVERLOAD - || TREE_CODE (expr) == FUNCTION_DECL - || TREE_CODE (expr) == TEMPLATE_DECL) + inner_expr = (TREE_CODE (expr) == ADDR_EXPR ? + TREE_OPERAND (expr, 0) : expr); + if (TREE_CODE (inner_expr) == OVERLOAD + || TREE_CODE (inner_expr) == FUNCTION_DECL + || TREE_CODE (inner_expr) == TEMPLATE_DECL + || TREE_CODE (inner_expr) == TEMPLATE_ID_EXPR) return expr; /* Preserve string constants; conversions from string constants to "char *" are allowed, even though normally a "const char *" |

