OSDN Git Service

PR c++/48322
[pf3gnuchains/gcc-fork.git] / gcc / cp / cp-tree.h
index 076754c..3f4f408 100644 (file)
@@ -53,7 +53,7 @@ c-common.h, not after.
       TREE_INDIRECT_USING (in NAMESPACE_DECL).
       CLEANUP_P (in TRY_BLOCK)
       AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
-      PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF)
+      PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF, SCOPE_REF)
       PAREN_STRING_LITERAL (in STRING_CST)
       DECL_PRETTY_FUNCTION_P (in VAR_DECL)
       KOENIG_LOOKUP_P (in CALL_EXPR)
@@ -62,8 +62,6 @@ c-common.h, not after.
       STMT_EXPR_NO_SCOPE (in STMT_EXPR)
       BIND_EXPR_TRY_BLOCK (in BIND_EXPR)
       TYPENAME_IS_ENUM_P (in TYPENAME_TYPE)
-      REFERENCE_REF_P (in INDIRECT_EXPR)
-      QUALIFIED_NAME_IS_TEMPLATE (in SCOPE_REF)
       OMP_FOR_GIMPLIFYING_P (in OMP_FOR)
       BASELINK_QUALIFIED_P (in BASELINK)
       TARGET_EXPR_IMPLICIT_P (in TARGET_EXPR)
@@ -73,6 +71,9 @@ c-common.h, not after.
       LAMBDA_EXPR_CAPTURES_THIS_P (in LAMBDA_EXPR)
       DECLTYPE_FOR_LAMBDA_CAPTURE (in DECLTYPE_TYPE)
       VEC_INIT_EXPR_IS_CONSTEXPR (in VEC_INIT_EXPR)
+      DECL_OVERRIDE_P (in FUNCTION_DECL)
+      IMPLICIT_CONV_EXPR_DIRECT_INIT (in IMPLICIT_CONV_EXPR)
+      TRANSACTION_EXPR_IS_STMT (in TRANSACTION_EXPR)
    1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
       TI_PENDING_TEMPLATE_FLAG.
       TEMPLATE_PARMS_FOR_INLINE.
@@ -84,7 +85,8 @@ c-common.h, not after.
       STMT_IS_FULL_EXPR_P (in _STMT)
       TARGET_EXPR_LIST_INIT_P (in TARGET_EXPR)
       LAMBDA_EXPR_MUTABLE_P (in LAMBDA_EXPR)
-      DECLTYPE_FOR_LAMBDA_RETURN (in DECLTYPE_TYPE)
+      DECL_FINAL_P (in FUNCTION_DECL)
+      QUALIFIED_NAME_IS_TEMPLATE (in SCOPE_REF)
    2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE)
       ICS_THIS_FLAG (in _CONV)
       DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
@@ -138,6 +140,7 @@ c-common.h, not after.
    5: DECL_INTERFACE_KNOWN.
    6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
       DECL_FIELD_IS_BASE (in FIELD_DECL)
+      TYPE_DECL_ALIAS_P (in TYPE_DECL)
    7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
       DECL_THUNK_P (in a member FUNCTION_DECL)
       DECL_NORMAL_CAPTURE_P (in FIELD_DECL)
@@ -200,6 +203,9 @@ c-common.h, not after.
 #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
   TREE_CHECK4(NODE,VAR_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
 
+#define VAR_TEMPL_TYPE_FIELD_OR_FUNCTION_DECL_CHECK(NODE) \
+  TREE_CHECK5(NODE,VAR_DECL,FIELD_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
+
 #define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
   TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
 
@@ -267,7 +273,8 @@ typedef struct ptrmem_cst * ptrmem_cst_t;
 #define BIND_EXPR_BODY_BLOCK(NODE) \
   TREE_LANG_FLAG_3 (BIND_EXPR_CHECK (NODE))
 #define FUNCTION_NEEDS_BODY_BLOCK(NODE) \
-  (DECL_CONSTRUCTOR_P (NODE) || DECL_DESTRUCTOR_P (NODE))
+  (DECL_CONSTRUCTOR_P (NODE) || DECL_DESTRUCTOR_P (NODE) \
+   || LAMBDA_FUNCTION_P (NODE))
 
 #define STATEMENT_LIST_NO_SCOPE(NODE) \
   TREE_LANG_FLAG_0 (STATEMENT_LIST_CHECK (NODE))
@@ -292,10 +299,6 @@ typedef struct ptrmem_cst * ptrmem_cst_t;
 #define same_type_p(TYPE1, TYPE2) \
   comptypes ((TYPE1), (TYPE2), COMPARE_STRICT)
 
-/* Nonzero if we are presently building a statement tree, rather
-   than expanding each statement as we encounter it.  */
-#define building_stmt_tree()  (cur_stmt_list != NULL_TREE)
-
 /* Returns nonzero iff NODE is a declaration for the global function
    `main'.  */
 #define DECL_MAIN_P(NODE)                              \
@@ -395,7 +398,13 @@ typedef enum cpp0x_warn_str
   /* defaulted and deleted functions */
   CPP0X_DEFAULTED_DELETED,
   /* inline namespaces */
-  CPP0X_INLINE_NAMESPACES
+  CPP0X_INLINE_NAMESPACES,
+  /* override controls, override/final */
+  CPP0X_OVERRIDE_CONTROLS,
+  /* non-static data member initializers */
+  CPP0X_NSDMI,
+  /* user defined literals */
+  CPP0X_USER_DEFINED_LITERALS
 } cpp0x_warn_str;
   
 /* The various kinds of operation used by composite_pointer_type. */
@@ -510,6 +519,23 @@ struct GTY (()) tree_default_arg {
   VEC(tree,gc) *instantiations;
 };
 
+
+#define DEFERRED_NOEXCEPT_PATTERN(NODE) \
+  (((struct tree_deferred_noexcept *)DEFERRED_NOEXCEPT_CHECK (NODE))->pattern)
+#define DEFERRED_NOEXCEPT_ARGS(NODE) \
+  (((struct tree_deferred_noexcept *)DEFERRED_NOEXCEPT_CHECK (NODE))->args)
+#define DEFERRED_NOEXCEPT_SPEC_P(NODE)                         \
+  ((NODE) && (TREE_PURPOSE (NODE))                             \
+  && (TREE_CODE (TREE_PURPOSE (NODE)) == DEFERRED_NOEXCEPT     \
+      || is_overloaded_fn (TREE_PURPOSE (NODE))))
+
+struct GTY (()) tree_deferred_noexcept {
+  struct tree_base base;
+  tree pattern;
+  tree args;
+};
+
+
 /* The condition associated with the static assertion.  This must be
    an integral constant expression.  */
 #define STATIC_ASSERT_CONDITION(NODE) \
@@ -542,6 +568,8 @@ struct GTY (()) tree_argument_pack_select {
 
 typedef enum cp_trait_kind
 {
+  CPTK_BASES,
+  CPTK_DIRECT_BASES,
   CPTK_HAS_NOTHROW_ASSIGN,
   CPTK_HAS_NOTHROW_CONSTRUCTOR,
   CPTK_HAS_NOTHROW_COPY,
@@ -556,12 +584,13 @@ typedef enum cp_trait_kind
   CPTK_IS_CONVERTIBLE_TO,
   CPTK_IS_EMPTY,
   CPTK_IS_ENUM,
+  CPTK_IS_LITERAL_TYPE,
   CPTK_IS_POD,
   CPTK_IS_POLYMORPHIC,
   CPTK_IS_STD_LAYOUT,
   CPTK_IS_TRIVIAL,
-  CPTK_IS_LITERAL_TYPE,
-  CPTK_IS_UNION
+  CPTK_IS_UNION,
+  CPTK_UNDERLYING_TYPE
 } cp_trait_kind;
 
 /* The types that we are processing.  */
@@ -610,7 +639,8 @@ enum cp_lambda_default_capture_mode_type {
 #define LAMBDA_EXPR_CAPTURE_LIST(NODE) \
   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->capture_list)
 
-/* The node in the capture-list that holds the 'this' capture.  */
+/* During parsing of the lambda, the node in the capture-list that holds
+   the 'this' capture.  */
 #define LAMBDA_EXPR_THIS_CAPTURE(NODE) \
   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->this_capture)
 
@@ -645,15 +675,28 @@ enum cp_lambda_default_capture_mode_type {
 #define LAMBDA_EXPR_DISCRIMINATOR(NODE) \
   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->discriminator)
 
+/* During parsing of the lambda, a vector of capture proxies which need
+   to be pushed once we're done processing a nested lambda.  */
+#define LAMBDA_EXPR_PENDING_PROXIES(NODE) \
+  (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->pending_proxies)
+
+/* The closure type of the lambda.  Note that the TREE_TYPE of a
+   LAMBDA_EXPR is always NULL_TREE, because we need to instantiate the
+   LAMBDA_EXPR in order to instantiate the type.  */
+#define LAMBDA_EXPR_CLOSURE(NODE) \
+  (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->closure)
+
 struct GTY (()) tree_lambda_expr
 {
-  struct tree_common common;
-  location_t locus;
-  enum cp_lambda_default_capture_mode_type default_capture_mode;
+  struct tree_typed typed;
   tree capture_list;
   tree this_capture;
   tree return_type;
   tree extra_scope;
+  tree closure;
+  VEC(tree,gc)* pending_proxies;
+  location_t locus;
+  enum cp_lambda_default_capture_mode_type default_capture_mode;
   int discriminator;
 };
 
@@ -695,17 +738,19 @@ enum cp_tree_node_structure_enum {
   TS_CP_BASELINK,
   TS_CP_WRAPPER,
   TS_CP_DEFAULT_ARG,
+  TS_CP_DEFERRED_NOEXCEPT,
   TS_CP_STATIC_ASSERT,
   TS_CP_ARGUMENT_PACK_SELECT,
   TS_CP_TRAIT_EXPR,
   TS_CP_LAMBDA_EXPR,
   TS_CP_TEMPLATE_INFO,
+  TS_CP_USERDEF_LITERAL,
   LAST_TS_CP_ENUM
 };
 
 /* The resulting tree type.  */
 union GTY((desc ("cp_tree_node_structure (&%h)"),
-       chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL"))) lang_tree_node {
+       chain_next ("(union lang_tree_node *) c_tree_chain_next (&%h.generic)"))) lang_tree_node {
   union tree_node GTY ((tag ("TS_CP_GENERIC"),
                        desc ("tree_node_structure (&%h)"))) generic;
   struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi;
@@ -713,6 +758,7 @@ union GTY((desc ("cp_tree_node_structure (&%h)"),
   struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
   struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
   struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg;
+  struct tree_deferred_noexcept GTY ((tag ("TS_CP_DEFERRED_NOEXCEPT"))) deferred_noexcept;
   struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier;
   struct tree_static_assert GTY ((tag ("TS_CP_STATIC_ASSERT"))) 
     static_assertion;
@@ -724,6 +770,8 @@ union GTY((desc ("cp_tree_node_structure (&%h)"),
     lambda_expression;
   struct tree_template_info GTY ((tag ("TS_CP_TEMPLATE_INFO")))
     template_info;
+  struct tree_userdef_literal GTY ((tag ("TS_CP_USERDEF_LITERAL")))
+    userdef_literal;
 };
 
 \f
@@ -748,6 +796,7 @@ enum cp_tree_index
     CPTI_CLASS_TYPE,
     CPTI_UNKNOWN_TYPE,
     CPTI_INIT_LIST_TYPE,
+    CPTI_DEPENDENT_LAMBDA_RETURN_TYPE,
     CPTI_VTBL_TYPE,
     CPTI_VTBL_PTR_TYPE,
     CPTI_STD,
@@ -819,6 +868,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
 #define class_type_node                        cp_global_trees[CPTI_CLASS_TYPE]
 #define unknown_type_node              cp_global_trees[CPTI_UNKNOWN_TYPE]
 #define init_list_type_node            cp_global_trees[CPTI_INIT_LIST_TYPE]
+#define dependent_lambda_return_type_node cp_global_trees[CPTI_DEPENDENT_LAMBDA_RETURN_TYPE]
 #define vtbl_type_node                 cp_global_trees[CPTI_VTBL_TYPE]
 #define vtbl_ptr_type_node             cp_global_trees[CPTI_VTBL_PTR_TYPE]
 #define std_node                       cp_global_trees[CPTI_STD]
@@ -925,9 +975,13 @@ struct GTY(()) saved_scope {
   VEC(tree,gc) *lang_base;
   tree lang_name;
   tree template_parms;
-  struct cp_binding_level *x_previous_class_level;
+  cp_binding_level *x_previous_class_level;
   tree x_saved_tree;
 
+  /* Only used for uses of this in trailing return type.  */
+  tree x_current_class_ptr;
+  tree x_current_class_ref;
+
   int x_processing_template_decl;
   int x_processing_specialization;
   BOOL_BITFIELD x_processing_explicit_instantiation : 1;
@@ -938,8 +992,8 @@ struct GTY(()) saved_scope {
 
   struct stmt_tree_s x_stmt_tree;
 
-  struct cp_binding_level *class_bindings;
-  struct cp_binding_level *bindings;
+  cp_binding_level *class_bindings;
+  cp_binding_level *bindings;
 
   struct saved_scope *prev;
 };
@@ -1018,14 +1072,14 @@ struct GTY(()) language_function {
   BOOL_BITFIELD returns_value : 1;
   BOOL_BITFIELD returns_null : 1;
   BOOL_BITFIELD returns_abnormally : 1;
-  BOOL_BITFIELD in_function_try_handler : 1;
-  BOOL_BITFIELD in_base_initializer : 1;
+  BOOL_BITFIELD x_in_function_try_handler : 1;
+  BOOL_BITFIELD x_in_base_initializer : 1;
 
   /* True if this function can throw an exception.  */
   BOOL_BITFIELD can_throw : 1;
 
   htab_t GTY((param_is(struct named_label_entry))) x_named_labels;
-  struct cp_binding_level *bindings;
+  cp_binding_level *bindings;
   VEC(tree,gc) *x_local_names;
   htab_t GTY((param_is (struct cxx_int_tree_map))) extern_decl_map;
 };
@@ -1045,12 +1099,14 @@ struct GTY(()) language_function {
    PARM_DECL for the `this' pointer.  The current_class_ref is an
    expression for `*this'.  */
 
-#define current_class_ptr \
-  (cfun && cp_function_chain                                   \
-   ? cp_function_chain->x_current_class_ptr : NULL_TREE)
-#define current_class_ref \
-  ((cfun && cp_function_chain)                                  \
-   ? cp_function_chain->x_current_class_ref : NULL_TREE)
+#define current_class_ptr                      \
+  (*(cfun && cp_function_chain                 \
+     ? &cp_function_chain->x_current_class_ptr \
+     : &scope_chain->x_current_class_ptr))
+#define current_class_ref                      \
+  (*(cfun && cp_function_chain                 \
+     ? &cp_function_chain->x_current_class_ref \
+     : &scope_chain->x_current_class_ref))
 
 /* The EH_SPEC_BLOCK for the exception-specifiers for the current
    function, if any.  */
@@ -1084,9 +1140,9 @@ struct GTY(()) language_function {
   cp_function_chain->returns_abnormally
 
 /* Nonzero if we are processing a base initializer.  Zero elsewhere.  */
-#define in_base_initializer cp_function_chain->in_base_initializer
+#define in_base_initializer cp_function_chain->x_in_base_initializer
 
-#define in_function_try_handler cp_function_chain->in_function_try_handler
+#define in_function_try_handler cp_function_chain->x_in_function_try_handler
 
 /* Expression always returned from function, or error_mark_node
    otherwise, for use by the automatic named return value optimization.  */
@@ -1107,12 +1163,6 @@ struct GTY(()) language_function {
 #define ansi_assopname(CODE) \
   (assignment_operator_name_info[(int) (CODE)].identifier)
 
-/* True if NODE is an erroneous expression.  */
-
-#define error_operand_p(NODE)                                  \
-  ((NODE) == error_mark_node                                   \
-   || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node))
-\f
 /* TRUE if a tree code represents a statement.  */
 extern bool statement_code_p[MAX_TREE_CODES];
 
@@ -1319,6 +1369,7 @@ struct GTY(()) lang_type_class {
   unsigned has_complex_move_ctor : 1;
   unsigned has_complex_move_assign : 1;
   unsigned has_constexpr_ctor : 1;
+  unsigned is_final : 1;
 
   /* When adding a flag here, consider whether or not it ought to
      apply to a template instance if it applies to the template.  If
@@ -1327,7 +1378,7 @@ struct GTY(()) lang_type_class {
   /* There are some bits left to fill out a 32-bit word.  Keep track
      of this by updating the size of this bitfield whenever you add or
      remove a flag.  */
-  unsigned dummy : 3;
+  unsigned dummy : 2;
 
   tree primary_base;
   VEC(tree_pair_s,gc) *vcall_indices;
@@ -1435,6 +1486,11 @@ struct GTY((variable_size)) lang_type {
 #define CLASSTYPE_LAZY_DESTRUCTOR(NODE) \
   (LANG_TYPE_CLASS_CHECK (NODE)->lazy_destructor)
 
+/* Nonzero means that NODE (a class type) is final */
+#define CLASSTYPE_FINAL(NODE) \
+  (LANG_TYPE_CLASS_CHECK (NODE)->is_final)
+
+
 /* Nonzero means that this _CLASSTYPE node overloads operator=(X&).  */
 #define TYPE_HAS_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_copy_assign)
 
@@ -1776,7 +1832,10 @@ struct GTY((variable_size)) lang_type {
    this type can raise.  Each TREE_VALUE is a _TYPE.  The TREE_VALUE
    will be NULL_TREE to indicate a throw specification of `()', or
    no exceptions allowed.  For a noexcept specification, TREE_VALUE
-   is NULL_TREE and TREE_PURPOSE is the constant-expression. */
+   is NULL_TREE and TREE_PURPOSE is the constant-expression.  For
+   a deferred noexcept-specification, TREE_PURPOSE is a DEFERRED_NOEXCEPT
+   (for templates) or an OVERLOAD list of functions (for implicitly
+   declared functions).  */
 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_LANG_SLOT_1 (NODE)
 
 /* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'
@@ -1910,7 +1969,7 @@ struct GTY(()) lang_decl_fn {
 
 struct GTY(()) lang_decl_ns {
   struct lang_decl_base base;
-  struct cp_binding_level *level;
+  cp_binding_level *level;
 };
 
 /* DECL_LANG_SPECIFIC for parameters.  */
@@ -2284,6 +2343,14 @@ struct GTY((variable_size)) lang_decl {
 #define DECL_INVALID_OVERRIDER_P(NODE) \
   (DECL_LANG_FLAG_4 (NODE))
 
+/* True (in a FUNCTION_DECL) if NODE is a function declared with
+   an override virt-specifier */
+#define DECL_OVERRIDE_P(NODE) (TREE_LANG_FLAG_0 (NODE))
+
+/* True (in a FUNCTION_DECL) if NODE is a function declared with
+   a final virt-specifier */
+#define DECL_FINAL_P(NODE) (TREE_LANG_FLAG_1 (NODE))
+
 /* The thunks associated with NODE, a FUNCTION_DECL.  */
 #define DECL_THUNKS(NODE) \
   (LANG_DECL_FN_CHECK (NODE)->context)
@@ -2476,6 +2543,18 @@ extern void decl_shadowed_for_var_insert (tree, tree);
 #define DECL_PENDING_INLINE_INFO(NODE) \
   (LANG_DECL_FN_CHECK (NODE)->u.pending_inline_info)
 
+/* Nonzero for TYPE_DECL means that it was written 'using name = type'.  */
+#define TYPE_DECL_ALIAS_P(NODE) \
+  DECL_LANG_FLAG_6 (TYPE_DECL_CHECK (NODE))
+
+/* Nonzero for a type which is an alias for another type; i.e, a type
+   which declaration was written 'using name-of-type =
+   another-type'.  */
+#define TYPE_ALIAS_P(NODE)                     \
+  (TYPE_P (NODE)                               \
+   && TYPE_NAME (NODE)                         \
+   && TYPE_DECL_ALIAS_P (TYPE_NAME (NODE)))
+
 /* For a class type: if this structure has many fields, we'll sort them
    and put them into a TREE_VEC.  */
 #define CLASSTYPE_SORTED_FIELDS(NODE) \
@@ -2501,7 +2580,7 @@ extern void decl_shadowed_for_var_insert (tree, tree);
    global function f.  In this case, DECL_TEMPLATE_INFO for S<int>::f
    will be non-NULL, but DECL_USE_TEMPLATE will be zero.  */
 #define DECL_TEMPLATE_INFO(NODE) \
-  (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE)) \
+  (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_FIELD_OR_FUNCTION_DECL_CHECK (NODE)) \
    ->u.min.template_info)
 
 /* For a VAR_DECL, indicates that the variable is actually a
@@ -2527,21 +2606,25 @@ extern void decl_shadowed_for_var_insert (tree, tree);
    ->template_info)
 
 /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE.  */
-#define TYPE_TEMPLATE_INFO(NODE)                       \
-  (TREE_CODE (NODE) == ENUMERAL_TYPE                   \
-   ? ENUM_TEMPLATE_INFO (NODE) :                       \
-   (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM   \
-    ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) :    \
-    (TYPE_LANG_SPECIFIC (NODE)                         \
-     ? CLASSTYPE_TEMPLATE_INFO (NODE)                  \
-     : NULL_TREE)))
+#define TYPE_TEMPLATE_INFO(NODE)                                       \
+  (TREE_CODE (NODE) == ENUMERAL_TYPE                                   \
+   ? ENUM_TEMPLATE_INFO (NODE) :                                       \
+   (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM                   \
+    ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) :                    \
+    ((CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE))                     \
+     ? CLASSTYPE_TEMPLATE_INFO (NODE)                                  \
+     : ((TYPE_NAME (NODE) && DECL_LANG_SPECIFIC (TYPE_NAME (NODE)))    \
+       ? (DECL_TEMPLATE_INFO (TYPE_NAME (NODE)))                       \
+       : NULL_TREE))))
 
 /* Set the template information for an ENUMERAL_, RECORD_, or
    UNION_TYPE to VAL.  */
-#define SET_TYPE_TEMPLATE_INFO(NODE, VAL)      \
-  (TREE_CODE (NODE) == ENUMERAL_TYPE           \
-   ? (ENUM_TEMPLATE_INFO (NODE) = (VAL))       \
-   : (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)))
+#define SET_TYPE_TEMPLATE_INFO(NODE, VAL)                              \
+  (TREE_CODE (NODE) == ENUMERAL_TYPE                                   \
+   ? (ENUM_TEMPLATE_INFO (NODE) = (VAL))                               \
+   : ((CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE))                    \
+      ? (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL))                       \
+      : (DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) = (VAL))))
 
 #define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE))
 #define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE))
@@ -2646,7 +2729,10 @@ extern void decl_shadowed_for_var_insert (tree, tree);
      template <class T> struct S { friend void f<int>(int, double); }
 
    the DECL_TI_TEMPLATE will be an IDENTIFIER_NODE for `f' and the
-   DECL_TI_ARGS will be {int}.  */
+   DECL_TI_ARGS will be {int}.
+
+   For a FIELD_DECL with a non-static data member initializer, this value
+   is the FIELD_DECL it was instantiated from.  */
 #define DECL_TI_TEMPLATE(NODE)      TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
 
 /* The template arguments used to obtain this decl from the most
@@ -2724,7 +2810,17 @@ extern void decl_shadowed_for_var_insert (tree, tree);
 
 /* The list of parameter packs used in the PACK_EXPANSION_* node. The
    TREE_VALUE of each TREE_LIST contains the parameter packs.  */
-#define PACK_EXPANSION_PARAMETER_PACKS(NODE) TREE_CHAIN (NODE)
+#define PACK_EXPANSION_PARAMETER_PACKS(NODE)           \
+  *(TREE_CODE (NODE) == EXPR_PACK_EXPANSION            \
+    ? &TREE_OPERAND (NODE, 1)                          \
+    : &TYPE_MINVAL (TYPE_PACK_EXPANSION_CHECK (NODE)))
+
+/* Any additional template args to be applied when substituting into
+   the pattern, set by tsubst_pack_expansion for partial instantiations.  */
+#define PACK_EXPANSION_EXTRA_ARGS(NODE)                \
+  *(TREE_CODE (NODE) == TYPE_PACK_EXPANSION    \
+    ? &TYPE_MAXVAL (NODE)                      \
+    : &TREE_OPERAND ((NODE), 2))
 
 /* Determine if this is an argument pack.  */
 #define ARGUMENT_PACK_P(NODE)                          \
@@ -2780,9 +2876,12 @@ extern void decl_shadowed_for_var_insert (tree, tree);
   (LANG_DECL_FN_CHECK (FUNCTION_DECL_CHECK (NODE))     \
    ->u.saved_language_function)
 
-/* Indicates an indirect_expr is for converting a reference.  */
-#define REFERENCE_REF_P(NODE) \
-  TREE_LANG_FLAG_0 (INDIRECT_REF_CHECK (NODE))
+/* True if NODE is an implicit INDIRECT_EXPR from convert_from_reference.  */
+#define REFERENCE_REF_P(NODE)                          \
+  (TREE_CODE (NODE) == INDIRECT_REF                    \
+   && TREE_TYPE (TREE_OPERAND (NODE, 0))               \
+   && (TREE_CODE (TREE_TYPE (TREE_OPERAND ((NODE), 0)))        \
+       == REFERENCE_TYPE))
 
 #define NEW_EXPR_USE_GLOBAL(NODE) \
   TREE_LANG_FLAG_0 (NEW_EXPR_CHECK (NODE))
@@ -2895,8 +2994,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
        (arg) = next_aggr_init_expr_arg (&(iter)))
 
 /* VEC_INIT_EXPR accessors.  */
-#define VEC_INIT_EXPR_SLOT(NODE) TREE_OPERAND (NODE, 0)
-#define VEC_INIT_EXPR_INIT(NODE) TREE_OPERAND (NODE, 1)
+#define VEC_INIT_EXPR_SLOT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 0)
+#define VEC_INIT_EXPR_INIT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 1)
 
 /* Indicates that a VEC_INIT_EXPR is a potential constant expression.
    Only set when the current function is constexpr.  */
@@ -2920,7 +3019,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
    this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
    corresponding TYPE_DECL.  However, this may also be a
    TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'.  */
-#define TYPENAME_TYPE_FULLNAME(NODE) (TYPENAME_TYPE_CHECK (NODE))->type.values
+#define TYPENAME_TYPE_FULLNAME(NODE) \
+  (TYPE_VALUES_RAW (TYPENAME_TYPE_CHECK (NODE)))
 
 /* True if a TYPENAME_TYPE was declared as an "enum".  */
 #define TYPENAME_IS_ENUM_P(NODE) \
@@ -2935,10 +3035,6 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define TYPENAME_IS_RESOLVING_P(NODE) \
   (TREE_LANG_FLAG_2 (TYPENAME_TYPE_CHECK (NODE)))
 
-/* Nonzero in INTEGER_CST means that this int is negative by dint of
-   using a twos-complement negated operand.  */
-#define TREE_NEGATED_INT(NODE) TREE_LANG_FLAG_0 (INTEGER_CST_CHECK (NODE))
-
 /* [class.virtual]
 
    A class that declares or inherits a virtual function is called a
@@ -3134,8 +3230,9 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 
 /* [dcl.init.aggr]
 
-   An aggregate is an array or a class with no user-declared
-   constructors, no private or protected non-static data members, no
+   An aggregate is an array or a class with no user-provided
+   constructors, no brace-or-equal-initializers for non-static data
+   members, no private or protected non-static data members, no
    base classes, and no virtual functions.
 
    As an extension, we also treat vectors as aggregates.  Keep these
@@ -3183,6 +3280,11 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
    B b{1,2}, not B b({1,2}) or B b = {1,2}.  */
 #define CONSTRUCTOR_IS_DIRECT_INIT(NODE) (TREE_LANG_FLAG_0 (CONSTRUCTOR_CHECK (NODE)))
 
+/* True if NODE represents a conversion for direct-initialization in a
+   template.  Set by perform_implicit_conversion_flags.  */
+#define IMPLICIT_CONV_EXPR_DIRECT_INIT(NODE) \
+  (TREE_LANG_FLAG_0 (IMPLICIT_CONV_EXPR_CHECK (NODE)))
+
 /* Nonzero means that an object of this type can not be initialized using
    an initializer list.  */
 #define CLASSTYPE_NON_AGGREGATE(NODE) \
@@ -3305,7 +3407,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 /* Indicates when overload resolution may resolve to a pointer to
    member function. [expr.unary.op]/3 */
 #define PTRMEM_OK_P(NODE) \
-  TREE_LANG_FLAG_0 (TREE_CHECK2 ((NODE), ADDR_EXPR, OFFSET_REF))
+  TREE_LANG_FLAG_0 (TREE_CHECK3 ((NODE), ADDR_EXPR, OFFSET_REF, SCOPE_REF))
 
 /* Get the POINTER_TYPE to the METHOD_TYPE associated with this
    pointer to member function.  TYPE_PTRMEMFUNC_P _must_ be true,
@@ -3358,24 +3460,35 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member)
 
 /* The expression in question for a TYPEOF_TYPE.  */
-#define TYPEOF_TYPE_EXPR(NODE) (TYPEOF_TYPE_CHECK (NODE))->type.values
+#define TYPEOF_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (TYPEOF_TYPE_CHECK (NODE)))
+
+/* The type in question for an UNDERLYING_TYPE.  */
+#define UNDERLYING_TYPE_TYPE(NODE) \
+  (TYPE_VALUES_RAW (UNDERLYING_TYPE_CHECK (NODE)))
+
+/* The type in question for BASES.  */
+#define BASES_TYPE(NODE) \
+  (TYPE_VALUES_RAW (BASES_CHECK (NODE)))
+
+#define BASES_DIRECT(NODE) \
+  TREE_LANG_FLAG_0 (BASES_CHECK (NODE))
 
 /* The expression in question for a DECLTYPE_TYPE.  */
-#define DECLTYPE_TYPE_EXPR(NODE) (DECLTYPE_TYPE_CHECK (NODE))->type.values
+#define DECLTYPE_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (DECLTYPE_TYPE_CHECK (NODE)))
 
 /* Whether the DECLTYPE_TYPE_EXPR of NODE was originally parsed as an
    id-expression or a member-access expression. When false, it was
    parsed as a full expression.  */
 #define DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P(NODE) \
-  (DECLTYPE_TYPE_CHECK (NODE))->type.string_flag
+  (DECLTYPE_TYPE_CHECK (NODE))->type_common.string_flag
 
 /* These flags indicate that we want different semantics from normal
-   decltype: lambda capture just drops references, lambda return also does
-   type decay.  */
+   decltype: lambda capture just drops references, lambda proxies look
+   through implicit dereference.  */
 #define DECLTYPE_FOR_LAMBDA_CAPTURE(NODE) \
   TREE_LANG_FLAG_0 (DECLTYPE_TYPE_CHECK (NODE))
-#define DECLTYPE_FOR_LAMBDA_RETURN(NODE) \
-  TREE_LANG_FLAG_1 (DECLTYPE_TYPE_CHECK (NODE))
+#define DECLTYPE_FOR_LAMBDA_PROXY(NODE) \
+  TREE_LANG_FLAG_2 (DECLTYPE_TYPE_CHECK (NODE))
 
 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
    specified in its declaration.  This can also be set for an
@@ -3532,13 +3645,24 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
    && !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \
    && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
 
-/* Nonzero for a DECL that represents a template class.  */
-#define DECL_CLASS_TEMPLATE_P(NODE)                            \
+/* Nonzero for a DECL that represents a class template or alias
+   template.  */
+#define DECL_TYPE_TEMPLATE_P(NODE)                             \
   (TREE_CODE (NODE) == TEMPLATE_DECL                           \
    && DECL_TEMPLATE_RESULT (NODE) != NULL_TREE                 \
+   && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL)
+
+/* Nonzero for a DECL that represents a class template.  */
+#define DECL_CLASS_TEMPLATE_P(NODE)                            \
+  (DECL_TYPE_TEMPLATE_P (NODE)                                 \
    && DECL_IMPLICIT_TYPEDEF_P (DECL_TEMPLATE_RESULT (NODE)))
 
-/* Nonzero if NODE which declares a type.  */
+/* Nonzero for a TEMPLATE_DECL that represents an alias template.  */
+#define DECL_ALIAS_TEMPLATE_P(NODE)                    \
+  (DECL_TYPE_TEMPLATE_P (NODE)                         \
+   && !DECL_ARTIFICIAL (DECL_TEMPLATE_RESULT (NODE)))
+
+/* Nonzero for a NODE which declares a type.  */
 #define DECL_DECLARES_TYPE_P(NODE) \
   (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
 
@@ -3649,6 +3773,17 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
   (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
 
+/* Nonzero if DECL is a function generated from a function 'temploid',
+   i.e. template, member of class template, or dependent friend.  */
+#define DECL_TEMPLOID_INSTANTIATION(DECL)              \
+  (DECL_TEMPLATE_INSTANTIATION (DECL)                  \
+   || DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (DECL))
+
+/* Nonzero if DECL is either defined implicitly by the compiler or
+   generated from a temploid.  */
+#define DECL_GENERATED_P(DECL) \
+  (DECL_TEMPLOID_INSTANTIATION (DECL) || DECL_DEFAULTED_FN (DECL))
+
 /* Nonzero iff we are currently processing a declaration for an
    entity with its own template parameter list, and which is not a
    full specialization.  */
@@ -3746,7 +3881,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 /* True for a SCOPE_REF iff the "template" keyword was used to
    indicate that the qualified name denotes a template.  */
 #define QUALIFIED_NAME_IS_TEMPLATE(NODE) \
-  (TREE_LANG_FLAG_0 (SCOPE_REF_CHECK (NODE)))
+  (TREE_LANG_FLAG_1 (SCOPE_REF_CHECK (NODE)))
 
 /* True for an OMP_ATOMIC that has dependent parameters.  These are stored
    as an expr in operand 1, and integer_zero_node in operand 0.  */
@@ -3764,6 +3899,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
   TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
                                     OMP_CLAUSE_COPYPRIVATE))
 
+/* Nonzero if this transaction expression's body contains statements.  */
+#define TRANSACTION_EXPR_IS_STMT(NODE) \
+   TREE_LANG_FLAG_0 (TRANSACTION_EXPR_CHECK (NODE))
+
 /* These macros provide convenient access to the various _STMT nodes
    created when parsing template declarations.  */
 #define TRY_STMTS(NODE)                TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0)
@@ -3823,6 +3962,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
 #define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
 #define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
+#define SWITCH_STMT_SCOPE(NODE)        TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 3)
 
 /* STMT_EXPR accessor.  */
 #define STMT_EXPR_STMT(NODE)   TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
@@ -4134,6 +4274,17 @@ extern GTY(()) VEC(tree,gc) *local_classes;
              LAMBDANAME_PREFIX, \
             sizeof (LAMBDANAME_PREFIX) - 1))
 
+#define UDLIT_OP_ANSI_PREFIX "operator\"\" "
+#define UDLIT_OP_ANSI_FORMAT UDLIT_OP_ANSI_PREFIX "%s"
+#define UDLIT_OP_MANGLED_PREFIX "li"
+#define UDLIT_OP_MANGLED_FORMAT UDLIT_OP_MANGLED_PREFIX "%s"
+#define UDLIT_OPER_P(ID_NODE) \
+  (!strncmp (IDENTIFIER_POINTER (ID_NODE), \
+             UDLIT_OP_ANSI_PREFIX, \
+            sizeof (UDLIT_OP_ANSI_PREFIX) - 1))
+#define UDLIT_OP_SUFFIX(ID_NODE) \
+  (IDENTIFIER_POINTER (ID_NODE) + sizeof (UDLIT_OP_ANSI_PREFIX) - 1)
+
 #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
 
 #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
@@ -4235,6 +4386,10 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, TYPENAME_FLAG };
 /* Used in calls to store_init_value to suppress its usual call to
    digest_init.  */
 #define LOOKUP_ALREADY_DIGESTED (LOOKUP_DEFAULTED << 1)
+/* An instantiation with explicit template arguments.  */
+#define LOOKUP_EXPLICIT_TMPL_ARGS (LOOKUP_ALREADY_DIGESTED << 1)
+/* Like LOOKUP_NO_TEMP_BIND, but also prevent binding to xvalues.  */
+#define LOOKUP_NO_RVAL_BIND (LOOKUP_EXPLICIT_TMPL_ARGS << 1)
 
 #define LOOKUP_NAMESPACES_ONLY(F)  \
   (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
@@ -4335,9 +4490,10 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, TYPENAME_FLAG };
 
 /* These macros are for accessing the fields of TEMPLATE_TYPE_PARM,
    TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes.  */
-#define TEMPLATE_TYPE_PARM_INDEX(NODE)                                  \
-  (TREE_CHECK3 ((NODE), TEMPLATE_TYPE_PARM, TEMPLATE_TEMPLATE_PARM,    \
-               BOUND_TEMPLATE_TEMPLATE_PARM))->type.values
+#define TEMPLATE_TYPE_PARM_INDEX(NODE)                                 \
+  (TYPE_VALUES_RAW (TREE_CHECK3 ((NODE), TEMPLATE_TYPE_PARM,           \
+                                TEMPLATE_TEMPLATE_PARM,                \
+                                BOUND_TEMPLATE_TEMPLATE_PARM)))
 #define TEMPLATE_TYPE_IDX(NODE) \
   (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
 #define TEMPLATE_TYPE_LEVEL(NODE) \
@@ -4419,6 +4575,22 @@ extern GTY(()) operator_name_info_t assignment_operator_name_info
 
 typedef int cp_cv_quals;
 
+/* Non-static member functions have an optional virt-specifier-seq.
+   There is a VIRT_SPEC value for each virt-specifier.
+   They can be combined by bitwise-or to form the complete set of
+   virt-specifiers for a member function.  */
+enum virt_specifier
+  {
+    VIRT_SPEC_UNSPECIFIED = 0x0,
+    VIRT_SPEC_FINAL       = 0x1,
+    VIRT_SPEC_OVERRIDE    = 0x2
+  };
+
+/* A type-qualifier, or bitmask therefore, using the VIRT_SPEC
+   constants.  */
+
+typedef int cp_virt_specifiers;
+
 /* A storage class.  */
 
 typedef enum cp_storage_class {
@@ -4448,6 +4620,7 @@ typedef enum cp_decl_spec {
   ds_explicit,
   ds_friend,
   ds_typedef,
+  ds_alias,
   ds_constexpr,
   ds_complex,
   ds_thread,
@@ -4475,8 +4648,8 @@ typedef struct cp_decl_specifier_seq {
   /* The storage class specified -- or sc_none if no storage class was
      explicitly specified.  */
   cp_storage_class storage_class;
-  /* True iff TYPE_SPEC indicates a user-defined type.  */
-  BOOL_BITFIELD user_defined_type_p : 1;
+  /* True iff TYPE_SPEC defines a class or enum.  */
+  BOOL_BITFIELD type_definition_p : 1;
   /* True iff multiple types were (erroneously) specified for this
      decl-specifier-seq.  */
   BOOL_BITFIELD multiple_types_p : 1;
@@ -4561,6 +4734,8 @@ struct cp_declarator {
       tree parameters;
       /* The cv-qualifiers for the function.  */
       cp_cv_quals qualifiers;
+      /* The virt-specifiers for the function.  */
+      cp_virt_specifiers virt_specifiers;
       /* The exception-specification for the function.  */
       tree exception_specification;
       /* The late-specified return type, if any.  */
@@ -4590,7 +4765,7 @@ struct cp_declarator {
 };
 
 /* A level of template instantiation.  */
-struct GTY(()) tinst_level {
+struct GTY((chain_next ("%h.next"))) tinst_level {
   /* The immediately deeper level in the chain.  */
   struct tinst_level *next;
 
@@ -4602,10 +4777,32 @@ struct GTY(()) tinst_level {
   /* The location where the template is instantiated.  */
   location_t locus;
 
+  /* errorcount+sorrycount when we pushed this level.  */
+  int errors;
+
   /* True if the location is in a system header.  */
   bool in_system_header_p;
 };
 
+/* Return the type of the `this' parameter of FNTYPE.  */
+
+static inline tree
+type_of_this_parm (const_tree fntype)
+{
+  function_args_iterator iter;
+  gcc_assert (TREE_CODE (fntype) == METHOD_TYPE);
+  function_args_iter_init (&iter, fntype);
+  return function_args_iter_cond (&iter);
+}
+
+/* Return the class of the `this' parameter of FNTYPE.  */
+
+static inline tree
+class_of_this_parm (const_tree fntype)
+{
+  return TREE_TYPE (type_of_this_parm (fntype));
+}
+
 /* A parameter list indicating for a function with no parameters,
    e.g  "int f(void)".  */
 extern cp_parameter_declarator *no_parameters;
@@ -4619,9 +4816,11 @@ extern bool check_dtor_name                      (tree, tree);
 extern tree build_conditional_expr             (tree, tree, tree, 
                                                  tsubst_flags_t);
 extern tree build_addr_func                    (tree);
+extern void set_flags_from_callee              (tree);
 extern tree build_call_a                       (tree, int, tree*);
 extern tree build_call_n                       (tree, int, ...);
 extern bool null_ptr_cst_p                     (tree);
+extern bool null_member_pointer_value_p                (tree);
 extern bool sufficient_parms_p                 (const_tree);
 extern tree type_decays_to                     (tree);
 extern tree build_user_type_conversion         (tree, tree, int);
@@ -4635,7 +4834,7 @@ extern tree build_new_method_call         (tree, tree, VEC(tree,gc) **,
 extern tree build_special_member_call          (tree, tree, VEC(tree,gc) **,
                                                 tree, int, tsubst_flags_t);
 extern tree build_new_op                       (enum tree_code, int, tree, 
-                                                tree, tree, bool *,
+                                                tree, tree, tree *,
                                                 tsubst_flags_t);
 extern tree build_op_call                      (tree, VEC(tree,gc) **,
                                                 tsubst_flags_t);
@@ -4653,8 +4852,9 @@ extern tree cxx_type_promotes_to          (tree);
 extern tree type_passed_as                     (tree);
 extern tree convert_for_arg_passing            (tree, tree);
 extern bool is_properly_derived_from           (tree, tree);
-extern tree set_up_extended_ref_temp           (tree, tree, tree *, tree *);
-extern tree initialize_reference               (tree, tree, tree, tree *, tsubst_flags_t);
+extern tree initialize_reference               (tree, tree, int,
+                                                tsubst_flags_t);
+extern tree extend_ref_init_temps              (tree, tree, VEC(tree,gc)**);
 extern tree make_temporary_var_for_ref_to_temp (tree, tree);
 extern tree strip_top_quals                    (tree);
 extern bool reference_related_p                        (tree, tree);
@@ -4674,7 +4874,7 @@ extern void validate_conversion_obstack           (void);
 /* in class.c */
 extern tree build_vfield_ref                   (tree, tree);
 extern tree build_base_path                    (enum tree_code, tree,
-                                                tree, int);
+                                                tree, int, tsubst_flags_t);
 extern tree convert_to_base                    (tree, tree, bool, bool,
                                                 tsubst_flags_t);
 extern tree convert_to_base_statically         (tree, tree);
@@ -4712,7 +4912,6 @@ extern void note_name_declared_in_class           (tree, tree);
 extern tree get_vtbl_decl_for_binfo            (tree);
 extern void debug_class                                (tree);
 extern void debug_thunks                       (tree);
-extern tree cp_fold_obj_type_ref               (tree, tree);
 extern void set_linkage_according_to_type      (tree, tree);
 extern void determine_key_method               (tree);
 extern void check_for_override                 (tree, tree);
@@ -4723,11 +4922,16 @@ extern tree in_class_defaulted_default_constructor (tree);
 extern bool user_provided_p                    (tree);
 extern bool type_has_user_provided_constructor  (tree);
 extern bool type_has_user_provided_default_constructor (tree);
-extern bool synthesized_default_constructor_is_constexpr (tree);
+extern tree default_init_uninitialized_part (tree);
+extern bool trivial_default_constructor_is_constexpr (tree);
 extern bool type_has_constexpr_default_constructor (tree);
 extern bool type_has_virtual_destructor                (tree);
 extern bool type_has_move_constructor          (tree);
 extern bool type_has_move_assign               (tree);
+extern bool type_has_user_declared_move_constructor (tree);
+extern bool type_has_user_declared_move_assign(tree);
+extern bool type_build_ctor_call               (tree);
+extern void explain_non_literal_class          (tree);
 extern void defaulted_late_check               (tree);
 extern bool defaultable_fn_check               (tree);
 extern void fixup_type_variants                        (tree);
@@ -4739,7 +4943,7 @@ extern void adjust_clone_args                     (tree);
 /* in cvt.c */
 extern tree convert_to_reference               (tree, tree, int, int, tree);
 extern tree convert_from_reference             (tree);
-extern tree force_rvalue                       (tree);
+extern tree force_rvalue                       (tree, tsubst_flags_t);
 extern tree ocp_convert                                (tree, tree, int, int);
 extern tree cp_convert                         (tree, tree);
 extern tree cp_convert_and_check                (tree, tree);
@@ -4760,7 +4964,7 @@ extern tree make_anon_name                        (void);
 extern tree pushdecl_top_level_maybe_friend    (tree, bool);
 extern tree pushdecl_top_level_and_finish      (tree, tree);
 extern tree check_for_out_of_scope_variable    (tree);
-extern void print_other_binding_stack          (struct cp_binding_level *);
+extern void print_other_binding_stack          (cp_binding_level *);
 extern tree maybe_push_decl                    (tree);
 extern tree current_decl_namespace             (void);
 
@@ -4827,7 +5031,6 @@ extern void finish_stmt                           (void);
 extern tree static_fn_type                     (tree);
 extern void revert_static_member_fn            (tree);
 extern void fixup_anonymous_aggr               (tree);
-extern int check_static_variable_definition    (tree, tree);
 extern tree compute_array_index_type           (tree, tree, tsubst_flags_t);
 extern tree check_default_argument             (tree, tree);
 typedef int (*walk_namespaces_fn)              (tree, void *);
@@ -4847,13 +5050,13 @@ extern tree cxx_comdat_group                    (tree);
 extern bool cp_missing_noreturn_ok_p           (tree);
 extern void initialize_artificial_var          (tree, VEC(constructor_elt,gc) *);
 extern tree check_var_type                     (tree, tree);
-extern tree reshape_init (tree, tree);
+extern tree reshape_init                        (tree, tree, tsubst_flags_t);
 extern tree next_initializable_field (tree);
 
 extern bool defer_mark_used_calls;
 extern GTY(()) VEC(tree, gc) *deferred_mark_used_calls;
 extern tree finish_case_label                  (location_t, tree, tree);
-extern tree cxx_maybe_build_cleanup            (tree);
+extern tree cxx_maybe_build_cleanup            (tree, tsubst_flags_t);
 
 /* in decl2.c */
 extern bool check_java_method                  (tree);
@@ -4865,7 +5068,7 @@ extern bool vague_linkage_p                       (tree);
 extern void grokclassfn                                (tree, tree,
                                                 enum overload_flags);
 extern tree grok_array_decl                    (tree, tree);
-extern tree delete_sanity                      (tree, tree, bool, int);
+extern tree delete_sanity                      (tree, tree, bool, int, tsubst_flags_t);
 extern tree check_classfn                      (tree, tree, tree);
 extern void check_member_template              (tree);
 extern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *,
@@ -4887,7 +5090,7 @@ extern tree build_offset_ref_call_from_tree       (tree, VEC(tree,gc) **);
 extern bool decl_constant_var_p                        (tree);
 extern bool decl_maybe_constant_var_p          (tree);
 extern void check_default_args                 (tree);
-extern void mark_used                          (tree);
+extern bool mark_used                          (tree);
 extern void finish_static_data_member_decl     (tree, tree, bool, tree, int);
 extern tree cp_build_parm_decl                 (tree, tree);
 extern tree get_guard                          (tree);
@@ -4928,6 +5131,7 @@ extern tree build_throw                           (tree);
 extern int nothrow_libfn_p                     (const_tree);
 extern void check_handlers                     (tree);
 extern tree finish_noexcept_expr               (tree, tsubst_flags_t);
+extern bool expr_noexcept_p                    (tree, tsubst_flags_t);
 extern void perform_deferred_noexcept_checks   (void);
 extern bool nothrow_spec_p                     (const_tree);
 extern bool type_noexcept_p                    (const_tree);
@@ -4972,14 +5176,16 @@ extern tree build_vec_init                      (tree, tree, tree, bool, int,
                                                  tsubst_flags_t);
 extern tree build_delete                       (tree, tree,
                                                 special_function_kind,
-                                                int, int);
+                                                int, int, tsubst_flags_t);
 extern void push_base_cleanups                 (void);
 extern tree build_vec_delete                   (tree, tree,
-                                                special_function_kind, int);
+                                                special_function_kind, int,
+                                                tsubst_flags_t);
 extern tree create_temporary_var               (tree);
 extern void initialize_vtbl_ptrs               (tree);
 extern tree build_java_class_ref               (tree);
 extern tree integral_constant_value            (tree);
+extern tree decl_constant_value_safe           (tree);
 extern int diagnose_uninitialized_cst_or_ref_member (tree, bool, bool);
 
 /* in lex.c */
@@ -5006,16 +5212,17 @@ extern void finish_thunk                        (tree);
 extern void use_thunk                          (tree, bool);
 extern bool trivial_fn_p                       (tree);
 extern bool maybe_explain_implicit_delete      (tree);
+extern void explain_implicit_non_constexpr     (tree);
 extern void synthesize_method                  (tree);
 extern tree lazily_declare_fn                  (special_function_kind,
                                                 tree);
 extern tree skip_artificial_parms_for          (const_tree, tree);
 extern int num_artificial_parms_for            (const_tree);
 extern tree make_alias_for                     (tree, tree);
-extern tree get_copy_ctor                      (tree);
+extern tree get_copy_ctor                      (tree, tsubst_flags_t);
 extern tree get_copy_assign                    (tree);
 extern tree get_default_ctor                   (tree);
-extern tree get_dtor                           (tree);
+extern tree get_dtor                           (tree, tsubst_flags_t);
 extern tree locate_ctor                                (tree);
 
 /* In optimize.c */
@@ -5060,12 +5267,14 @@ extern tree instantiate_class_template          (tree);
 extern tree instantiate_template               (tree, tree, tsubst_flags_t);
 extern int fn_type_unification                 (tree, tree, tree,
                                                 const tree *, unsigned int,
-                                                tree, unification_kind_t, int);
+                                                tree, unification_kind_t, int,
+                                                bool);
 extern void mark_decl_instantiated             (tree, int);
 extern int more_specialized_fn                 (tree, tree, int);
 extern void do_decl_instantiation              (tree, tree);
 extern void do_type_instantiation              (tree, tree, tsubst_flags_t);
 extern bool always_instantiate_p               (tree);
+extern void maybe_instantiate_noexcept         (tree);
 extern tree instantiate_decl                   (tree, int, bool);
 extern int comp_template_parms                 (const_tree, const_tree);
 extern bool uses_parameter_packs                (tree);
@@ -5104,6 +5313,7 @@ extern bool dependent_template_p          (tree);
 extern bool dependent_template_id_p            (tree, tree);
 extern bool type_dependent_expression_p                (tree);
 extern bool any_type_dependent_arguments_p      (const VEC(tree,gc) *);
+extern bool any_type_dependent_elements_p       (const_tree);
 extern bool type_dependent_expression_p_push   (tree);
 extern bool value_dependent_expression_p       (tree);
 extern bool any_value_dependent_elements_p      (const_tree);
@@ -5114,6 +5324,8 @@ extern tree build_non_dependent_expr              (tree);
 extern void make_args_non_dependent            (VEC(tree,gc) *);
 extern bool reregister_specialization          (tree, tree, tree);
 extern tree fold_non_dependent_expr            (tree);
+extern bool alias_type_or_template_p            (tree);
+extern bool alias_template_specialization_p     (tree);
 extern bool explicit_class_specialization_p     (tree);
 extern int push_tinst_level                     (tree);
 extern void pop_tinst_level                     (void);
@@ -5160,9 +5372,11 @@ extern tree lookup_field_1                       (tree, tree, bool);
 extern tree lookup_field                       (tree, tree, int, bool);
 extern int lookup_fnfields_1                   (tree, tree);
 extern tree lookup_fnfields_slot               (tree, tree);
+extern tree lookup_fnfields_slot_nolazy                (tree, tree);
 extern int class_method_index_for_fn           (tree, tree);
 extern tree lookup_fnfields                    (tree, tree, int);
-extern tree lookup_member                      (tree, tree, int, bool);
+extern tree lookup_member                      (tree, tree, int, bool,
+                                                tsubst_flags_t);
 extern int look_for_overrides                  (tree, tree);
 extern void get_pure_virtuals                  (tree);
 extern void maybe_suppress_debug_info          (tree);
@@ -5220,6 +5434,7 @@ extern int stmts_are_full_exprs_p         (void);
 extern void init_cp_semantics                  (void);
 extern tree do_poplevel                                (tree);
 extern void add_decl_expr                      (tree);
+extern tree maybe_cleanup_point_expr_void      (tree);
 extern tree finish_expr_stmt                   (tree);
 extern tree begin_if_stmt                      (void);
 extern void finish_if_stmt_cond                        (tree, tree);
@@ -5261,7 +5476,6 @@ extern void finish_handler_parms          (tree, tree);
 extern void finish_handler                     (tree);
 extern void finish_cleanup                     (tree, tree);
 extern bool literal_type_p (tree);
-extern tree validate_constexpr_fundecl (tree);
 extern tree register_constexpr_fundef (tree, tree);
 extern bool check_constexpr_ctor_body (tree, tree);
 extern tree ensure_literal_type_for_constexpr_object (tree);
@@ -5274,6 +5488,7 @@ extern tree maybe_constant_value (tree);
 extern tree maybe_constant_init (tree);
 extern bool is_sub_constant_expr (tree);
 extern bool reduced_constant_expression_p (tree);
+extern void explain_invalid_constexpr_fn (tree);
 extern VEC(tree,heap)* cx_error_context (void);
 
 enum {
@@ -5295,7 +5510,8 @@ extern tree finish_stmt_expr_expr         (tree, tree);
 extern tree finish_stmt_expr                   (tree, bool);
 extern tree stmt_expr_value_expr               (tree);
 bool empty_expr_stmt_p                         (tree);
-extern tree perform_koenig_lookup              (tree, VEC(tree,gc) *, bool);
+extern tree perform_koenig_lookup              (tree, VEC(tree,gc) *, bool,
+                                                tsubst_flags_t);
 extern tree finish_call_expr                   (tree, VEC(tree,gc) **, bool,
                                                 bool, tsubst_flags_t);
 extern tree finish_increment_expr              (tree, enum tree_code);
@@ -5319,6 +5535,10 @@ extern tree finish_id_expression         (tree, tree, tree,
                                                 const char **,
                                                  location_t);
 extern tree finish_typeof                      (tree);
+extern tree finish_underlying_type             (tree);
+extern tree calculate_bases                     (tree);
+extern tree finish_bases                        (tree, bool);
+extern tree calculate_direct_bases              (tree);
 extern tree finish_offsetof                    (tree);
 extern void finish_decl_cleanup                        (tree, tree);
 extern void finish_eh_cleanup                  (tree);
@@ -5345,15 +5565,19 @@ extern tree begin_omp_task                      (void);
 extern tree finish_omp_task                    (tree, tree);
 extern tree finish_omp_for                     (location_t, tree, tree,
                                                 tree, tree, tree, tree, tree);
-extern void finish_omp_atomic                  (enum tree_code, tree, tree);
+extern void finish_omp_atomic                  (enum tree_code, enum tree_code,
+                                                tree, tree, tree, tree, tree);
 extern void finish_omp_barrier                 (void);
 extern void finish_omp_flush                   (void);
 extern void finish_omp_taskwait                        (void);
+extern tree begin_transaction_stmt             (location_t, tree *, int);
+extern void finish_transaction_stmt            (tree, tree, int);
+extern tree build_transaction_expr             (location_t, tree, int);
+extern void finish_omp_taskyield               (void);
 extern bool cxx_omp_create_clause_info         (tree, tree, bool, bool, bool);
 extern tree baselink_for_fns                    (tree);
 extern void finish_static_assert                (tree, tree, location_t,
                                                  bool);
-extern tree describable_type                   (tree);
 extern tree finish_decltype_type                (tree, bool, tsubst_flags_t);
 extern tree finish_trait_expr                  (enum cp_trait_kind, tree, tree);
 extern tree build_lambda_expr                   (void);
@@ -5361,19 +5585,26 @@ extern tree build_lambda_object                 (tree);
 extern tree begin_lambda_type                   (tree);
 extern tree lambda_capture_field_type          (tree);
 extern tree lambda_return_type                 (tree);
+extern tree lambda_proxy_type                  (tree);
 extern tree lambda_function                    (tree);
 extern void apply_lambda_return_type            (tree, tree);
 extern tree add_capture                         (tree, tree, tree, bool, bool);
 extern tree add_default_capture                 (tree, tree, tree);
+extern tree build_capture_proxy                        (tree);
+extern void insert_pending_capture_proxies     (void);
+extern bool is_capture_proxy                   (tree);
+extern bool is_normal_capture_proxy             (tree);
 extern void register_capture_members           (tree);
 extern tree lambda_expr_this_capture            (tree);
 extern tree nonlambda_method_basetype          (void);
 extern void maybe_add_lambda_conv_op            (tree);
+extern bool is_lambda_ignored_entity            (tree);
 
 /* in tree.c */
+extern int cp_tree_operand_length              (const_tree);
 void cp_free_lang_data                                 (tree t);
-extern tree force_target_expr                  (tree, tree);
-extern tree build_target_expr_with_type                (tree, tree);
+extern tree force_target_expr                  (tree, tree, tsubst_flags_t);
+extern tree build_target_expr_with_type                (tree, tree, tsubst_flags_t);
 extern void lang_check_failed                  (const char *, int,
                                                 const char *) ATTRIBUTE_NORETURN;
 extern tree stabilize_expr                     (tree, tree *);
@@ -5406,10 +5637,11 @@ extern tree build_min_non_dep_call_vec          (tree, tree, VEC(tree,gc) *);
 extern tree build_cplus_new                    (tree, tree, tsubst_flags_t);
 extern tree build_aggr_init_expr               (tree, tree, tsubst_flags_t);
 extern tree get_target_expr                    (tree);
+extern tree get_target_expr_sfinae             (tree, tsubst_flags_t);
 extern tree build_cplus_array_type             (tree, tree);
 extern tree build_array_of_n_type              (tree, int);
 extern tree build_array_copy                   (tree);
-extern tree build_vec_init_expr                        (tree, tree);
+extern tree build_vec_init_expr                        (tree, tree, tsubst_flags_t);
 extern void diagnose_non_constexpr_vec_init    (tree);
 extern tree hash_tree_cons                     (tree, tree, tree);
 extern tree hash_tree_chain                    (tree, tree);
@@ -5419,6 +5651,7 @@ extern tree get_fns                               (tree);
 extern tree get_first_fn                       (tree);
 extern tree ovl_cons                           (tree, tree);
 extern tree build_overload                     (tree, tree);
+extern bool non_static_member_function_p        (tree);
 extern const char *cxx_printable_name          (tree, int);
 extern const char *cxx_printable_name_translate        (tree, int);
 extern tree build_exception_variant            (tree, tree);
@@ -5522,7 +5755,7 @@ extern tree cp_build_function_call_vec            (tree, VEC(tree,gc) **,
                                                 tsubst_flags_t);
 extern tree build_x_binary_op                  (enum tree_code, tree,
                                                 enum tree_code, tree,
-                                                enum tree_code, bool *,
+                                                enum tree_code, tree *,
                                                 tsubst_flags_t);
 extern tree build_x_array_ref                  (tree, tree, tsubst_flags_t);
 extern tree build_x_unary_op                   (enum tree_code, tree,
@@ -5591,6 +5824,8 @@ extern tree convert_ptrmem                        (tree, tree, bool, bool,
 extern int lvalue_or_else                      (tree, enum lvalue_use,
                                                  tsubst_flags_t);
 extern void check_template_keyword             (tree);
+extern bool check_raw_literal_operator         (const_tree decl);
+extern bool check_literal_operator_args                (const_tree, bool *, bool *);
 
 /* in typeck2.c */
 extern void require_complete_eh_spec_types     (tree, tree);
@@ -5606,16 +5841,16 @@ extern void complete_type_check_abstract        (tree);
 extern int abstract_virtuals_error             (tree, tree);
 extern int abstract_virtuals_error_sfinae      (tree, tree, tsubst_flags_t);
 
-extern tree store_init_value                   (tree, tree, int);
+extern tree store_init_value                   (tree, tree, VEC(tree,gc)**, int);
 extern void check_narrowing                    (tree, tree);
-extern tree digest_init                                (tree, tree);
+extern tree digest_init                                (tree, tree, tsubst_flags_t);
 extern tree digest_init_flags                  (tree, tree, int);
 extern tree build_scoped_ref                   (tree, tree, tree *);
 extern tree build_x_arrow                      (tree);
 extern tree build_m_component_ref              (tree, tree);
 extern tree build_functional_cast              (tree, tree, tsubst_flags_t);
 extern tree add_exception_specifier            (tree, tree, int);
-extern tree merge_exception_specifiers         (tree, tree);
+extern tree merge_exception_specifiers         (tree, tree, tree);
 
 /* in mangle.c */
 extern void init_mangle                                (void);
@@ -5648,6 +5883,7 @@ extern void init_shadowed_var_for_decl            (void);
 extern int cp_gimplify_expr                    (tree *, gimple_seq *,
                                                 gimple_seq *);
 extern void cp_genericize                      (tree);
+extern bool cxx_omp_const_qual_no_mutable      (tree);
 extern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree);
 extern tree cxx_omp_clause_default_ctor                (tree, tree, tree);
 extern tree cxx_omp_clause_copy_ctor           (tree, tree, tree);
@@ -5657,7 +5893,8 @@ extern void cxx_omp_finish_clause         (tree);
 extern bool cxx_omp_privatize_by_reference     (const_tree);
 
 /* in name-lookup.c */
-extern void suggest_alternatives_for (location_t, tree);
+extern void suggest_alternatives_for            (location_t, tree);
+extern tree strip_using_decl                    (tree);
 
 /* -- end of C++ */