diff options
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index 37a8654be0a..78ea4cf976a 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4802,6 +4802,15 @@ decl_function_context (decl) if (TREE_CODE (decl) == SAVE_EXPR) context = SAVE_EXPR_CONTEXT (decl); + /* C++ virtual functions use DECL_CONTEXT for the class of the vtable + where we look up the function at runtime. Such functions always take + a first argument of type 'pointer to real context'. + + C++ should really be fixed to use DECL_CONTEXT for the real context, + and use something else for the "virtual context". */ + else if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VINDEX (decl)) + context = TYPE_MAIN_VARIANT + (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl))))); else context = DECL_CONTEXT (decl); |