OSDN Git Service

Fix PR c++/44188
[pf3gnuchains/gcc-fork.git] / gcc / cp / cp-tree.h
index bbd1a42..5efe279 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for C++ parsing and type checking.
    Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com)
 
@@ -26,11 +26,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ggc.h"
 #include "function.h"
 #include "hashtab.h"
-#include "splay-tree.h"
 #include "vec.h"
-#include "varray.h"
-#include "c-common.h"
-#include "name-lookup.h"
 
 /* In order for the format checking to accept the C++ front end
    diagnostic framework extensions, you must include this file before
@@ -38,18 +34,17 @@ along with GCC; see the file COPYING3.  If not see
    in c-common.h.  */
 #undef GCC_DIAG_STYLE
 #define GCC_DIAG_STYLE __gcc_cxxdiag__
-#if GCC_VERSION >= 4001
-#define ATTRIBUTE_GCC_CXXDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
-#else
-#define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m)
-#endif
-#ifdef GCC_TOPLEV_H
+#if defined(GCC_TOPLEV_H) || defined (GCC_C_COMMON_H)
 #error \
 In order for the format checking to accept the C++ front end diagnostic \
-framework extensions, you must include this file before toplev.h, not after.
+framework extensions, you must include this file before toplev.h and \
+c-common.h, not after.
 #endif
 #include "toplev.h"
 #include "diagnostic.h"
+#include "c-family/c-common.h"
+
+#include "name-lookup.h"
 
 /* Usage of TREE_LANG_FLAG_?:
    0: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
@@ -74,9 +69,10 @@ framework extensions, you must include this file before toplev.h, not after.
       BASELINK_QUALIFIED_P (in BASELINK)
       TARGET_EXPR_IMPLICIT_P (in TARGET_EXPR)
       TEMPLATE_PARM_PARAMETER_PACK (in TEMPLATE_PARM_INDEX)
-      TYPE_REF_IS_RVALUE (in REFERENCE_TYPE)
       ATTR_IS_DEPENDENT (in the TREE_LIST for an attribute)
       CONSTRUCTOR_IS_DIRECT_INIT (in CONSTRUCTOR)
+      LAMBDA_EXPR_CAPTURES_THIS_P (in LAMBDA_EXPR)
+      DECLTYPE_FOR_LAMBDA_CAPTURE (in DECLTYPE_TYPE)
    1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
       TI_PENDING_TEMPLATE_FLAG.
       TEMPLATE_PARMS_FOR_INLINE.
@@ -87,11 +83,15 @@ framework extensions, you must include this file before toplev.h, not after.
       TYPENAME_IS_CLASS_P (in TYPENAME_TYPE)
       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)
    2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE)
       ICS_THIS_FLAG (in _CONV)
       DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
       STATEMENT_LIST_TRY_BLOCK (in STATEMENT_LIST)
       TYPENAME_IS_RESOLVING_P (in TYPE_NAME_TYPE)
+      LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P (in LAMBDA_EXPR)
+      TARGET_EXPR_DIRECT_INIT_P (in TARGET_EXPR)
    3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
       ICS_BAD_FLAG (in _CONV)
       FN_TRY_BLOCK_P (in TRY_BLOCK)
@@ -111,11 +111,10 @@ framework extensions, you must include this file before toplev.h, not after.
    Usage of TYPE_LANG_FLAG_?:
    0: TYPE_DEPENDENT_P
    1: TYPE_HAS_USER_CONSTRUCTOR.
-   2: Unused
+   2: unused
    3: TYPE_FOR_JAVA.
    4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
    5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE)
-      SCOPED_ENUM_P (in ENUMERAL_TYPE)
    6: TYPE_DEPENDENT_P_VALID
 
    Usage of DECL_LANG_FLAG_?:
@@ -140,6 +139,8 @@ framework extensions, you must include this file before toplev.h, not after.
       DECL_FIELD_IS_BASE (in FIELD_DECL)
    7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
       DECL_THUNK_P (in a member FUNCTION_DECL)
+      DECL_NORMAL_CAPTURE_P (in FIELD_DECL)
+   8: DECL_DECLARED_CONSTEXPR_P (in VAR_DECL, FUNCTION_DECL)
 
    Usage of language-independent fields in a language-dependent manner:
 
@@ -239,9 +240,6 @@ typedef struct template_parm_index_s template_parm_index;
 
 struct GTY(()) ptrmem_cst {
   struct tree_common common;
-  /* This isn't used, but the middle-end expects all constants to have
-     this field.  */
-  rtx rtl;
   tree member;
 };
 typedef struct ptrmem_cst * ptrmem_cst_t;
@@ -374,6 +372,52 @@ typedef enum cp_id_kind
   CP_ID_KIND_QUALIFIED
 } cp_id_kind;
 
+
+/* The various kinds of C++0x warnings we encounter. */
+
+typedef enum cpp0x_warn_str
+{
+  /* extended initializer lists */
+  CPP0X_INITIALIZER_LISTS,
+  /* explicit conversion operators */
+  CPP0X_EXPLICIT_CONVERSION,
+  /* variadic templates */
+  CPP0X_VARIADIC_TEMPLATES,
+  /* lambda expressions */
+  CPP0X_LAMBDA_EXPR,
+  /* C++0x auto */
+  CPP0X_AUTO,
+  /* scoped enums */
+  CPP0X_SCOPED_ENUMS,
+  /* defaulted and deleted functions */
+  CPP0X_DEFAULTED_DELETED
+} cpp0x_warn_str;
+  
+/* The various kinds of operation used by composite_pointer_type. */
+
+typedef enum composite_pointer_operation
+{
+  /* comparison */
+  CPO_COMPARISON,
+  /* conversion */
+  CPO_CONVERSION,
+  /* conditional expression */
+  CPO_CONDITIONAL_EXPR
+} composite_pointer_operation;
+
+/* The various readonly error string used by readonly_error.  */
+typedef enum readonly_error_kind
+{
+  /* assignment */
+  REK_ASSIGNMENT,
+  /* assignment (via 'asm' output) */
+  REK_ASSIGNMENT_ASM,
+  /* increment */
+  REK_INCREMENT,
+  /* decrement */
+  REK_DECREMENT
+} readonly_error_kind;
+
 /* Macros for access to language-specific slots in an identifier.  */
 
 #define IDENTIFIER_NAMESPACE_BINDINGS(NODE)    \
@@ -517,6 +561,109 @@ struct GTY (()) tree_trait_expr {
   enum cp_trait_kind kind;
 };
 
+/* Based off of TYPE_ANONYMOUS_P.  */
+#define LAMBDA_TYPE_P(NODE) \
+  (CLASS_TYPE_P (NODE) && LAMBDANAME_P (TYPE_LINKAGE_IDENTIFIER (NODE)))
+
+/* Test if FUNCTION_DECL is a lambda function.  */
+#define LAMBDA_FUNCTION_P(FNDECL) \
+  (DECL_OVERLOADED_OPERATOR_P (FNDECL) == CALL_EXPR \
+   && LAMBDA_TYPE_P (CP_DECL_CONTEXT (FNDECL)))
+
+enum cp_lambda_default_capture_mode_type {
+  CPLD_NONE,
+  CPLD_COPY,
+  CPLD_REFERENCE
+};
+
+/* The method of default capture, if any.  */
+#define LAMBDA_EXPR_DEFAULT_CAPTURE_MODE(NODE) \
+  (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->default_capture_mode)
+
+/* The capture-list, including `this'.  Each capture is stored as a FIELD_DECL
+ * so that the name, type, and field are all together, whether or not it has
+ * been added to the lambda's class type.
+   TREE_LIST:
+     TREE_PURPOSE: The FIELD_DECL for this capture.
+     TREE_VALUE: The initializer. This is part of a GNU extension.  */
+#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.  */
+#define LAMBDA_EXPR_THIS_CAPTURE(NODE) \
+  (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->this_capture)
+
+/* Predicate tracking whether `this' is in the effective capture set.  */
+#define LAMBDA_EXPR_CAPTURES_THIS_P(NODE) \
+  LAMBDA_EXPR_THIS_CAPTURE(NODE)
+
+/* Predicate tracking whether the lambda was declared 'mutable'.  */
+#define LAMBDA_EXPR_MUTABLE_P(NODE) \
+  TREE_LANG_FLAG_1 (LAMBDA_EXPR_CHECK (NODE))
+
+/* True iff we should try to deduce the lambda return type from any return
+   statement.  */
+#define LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P(NODE) \
+  TREE_LANG_FLAG_2 (LAMBDA_EXPR_CHECK (NODE))
+
+/* The return type in the expression.
+ * NULL_TREE indicates that none was specified.  */
+#define LAMBDA_EXPR_RETURN_TYPE(NODE) \
+  (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->return_type)
+
+/* The source location of the lambda.  */
+#define LAMBDA_EXPR_LOCATION(NODE) \
+  (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->locus)
+
+/* The mangling scope for the lambda: FUNCTION_DECL, PARM_DECL, VAR_DECL,
+   FIELD_DECL or NULL_TREE.  If this is NULL_TREE, we have no linkage.  */
+#define LAMBDA_EXPR_EXTRA_SCOPE(NODE) \
+  (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->extra_scope)
+
+/* If EXTRA_SCOPE, this is the number of the lambda within that scope.  */
+#define LAMBDA_EXPR_DISCRIMINATOR(NODE) \
+  (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->discriminator)
+
+struct GTY (()) tree_lambda_expr
+{
+  struct tree_common common;
+  location_t locus;
+  enum cp_lambda_default_capture_mode_type default_capture_mode;
+  tree capture_list;
+  tree this_capture;
+  tree return_type;
+  tree extra_scope;
+  int discriminator;
+};
+
+/* A (typedef,context,usage location) triplet.
+   It represents a typedef used through a
+   context at a given source location.
+   e.g.
+   struct foo {
+     typedef int myint;
+   };
+
+   struct bar {
+    foo::myint v; // #1<-- this location.
+   };
+
+   In bar, the triplet will be (myint, foo, #1).
+   */
+struct GTY(()) qualified_typedef_usage_s {
+  tree typedef_decl;
+  tree context;
+  location_t locus;
+};
+typedef struct qualified_typedef_usage_s qualified_typedef_usage_t;
+DEF_VEC_O (qualified_typedef_usage_t);
+DEF_VEC_ALLOC_O (qualified_typedef_usage_t,gc);
+
+struct GTY(()) tree_template_info {
+  struct tree_common common;
+  VEC(qualified_typedef_usage_t,gc) *typedefs_needing_access_checking;
+};
+
 enum cp_tree_node_structure_enum {
   TS_CP_GENERIC,
   TS_CP_IDENTIFIER,
@@ -530,6 +677,8 @@ enum cp_tree_node_structure_enum {
   TS_CP_STATIC_ASSERT,
   TS_CP_ARGUMENT_PACK_SELECT,
   TS_CP_TRAIT_EXPR,
+  TS_CP_LAMBDA_EXPR,
+  TS_CP_TEMPLATE_INFO,
   LAST_TS_CP_ENUM
 };
 
@@ -550,6 +699,10 @@ union GTY((desc ("cp_tree_node_structure (&%h)"),
     argument_pack_select;
   struct tree_trait_expr GTY ((tag ("TS_CP_TRAIT_EXPR")))
     trait_expression;
+  struct tree_lambda_expr GTY ((tag ("TS_CP_LAMBDA_EXPR")))
+    lambda_expression;
+  struct tree_template_info GTY ((tag ("TS_CP_TEMPLATE_INFO")))
+    template_info;
 };
 
 \f
@@ -605,6 +758,8 @@ enum cp_tree_index
     CPTI_LANG_NAME_JAVA,
 
     CPTI_EMPTY_EXCEPT_SPEC,
+    CPTI_NOEXCEPT_TRUE_SPEC,
+    CPTI_NOEXCEPT_FALSE_SPEC,
     CPTI_JCLASS,
     CPTI_TERMINATE,
     CPTI_CALL_UNEXPECTED,
@@ -615,6 +770,9 @@ enum cp_tree_index
 
     CPTI_KEYED_CLASSES,
 
+    CPTI_NULLPTR,
+    CPTI_NULLPTR_TYPE,
+
     CPTI_MAX
 };
 
@@ -649,6 +807,8 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
 #define abort_fndecl                   cp_global_trees[CPTI_ABORT_FNDECL]
 #define global_delete_fndecl           cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
 #define current_aggr                   cp_global_trees[CPTI_AGGR_TAG]
+#define nullptr_node                   cp_global_trees[CPTI_NULLPTR]
+#define nullptr_type_node              cp_global_trees[CPTI_NULLPTR_TYPE]
 
 /* We cache these tree nodes so as to call get_identifier less
    frequently.  */
@@ -689,6 +849,8 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
 
 /* Exception specifier used for throw().  */
 #define empty_except_spec              cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
+#define noexcept_true_spec             cp_global_trees[CPTI_NOEXCEPT_TRUE_SPEC]
+#define noexcept_false_spec            cp_global_trees[CPTI_NOEXCEPT_FALSE_SPEC]
 
 /* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*).  */
 #define jclass_node                    cp_global_trees[CPTI_JCLASS]
@@ -863,7 +1025,8 @@ struct GTY(()) language_function {
    expression for `*this'.  */
 
 #define current_class_ptr \
-  (cfun ? cp_function_chain->x_current_class_ptr : NULL_TREE)
+  (cfun && cp_function_chain                                   \
+   ? cp_function_chain->x_current_class_ptr : NULL_TREE)
 #define current_class_ref \
   (cfun ? cp_function_chain->x_current_class_ref : NULL_TREE)
 
@@ -1127,6 +1290,8 @@ struct GTY(()) lang_type_class {
   unsigned has_complex_dflt : 1;
   unsigned has_list_ctor : 1;
   unsigned non_std_layout : 1;
+  unsigned lazy_move_ctor : 1;
+  unsigned is_literal : 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
@@ -1135,7 +1300,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 : 9;
+  unsigned dummy : 7;
 
   tree primary_base;
   VEC(tree_pair_s,gc) *vcall_indices;
@@ -1159,6 +1324,8 @@ struct GTY(()) lang_type_class {
      to resort it if pointers get rearranged.  */
   struct sorted_fields_type * GTY ((reorder ("resort_sorted_fields")))
     sorted_fields;
+  /* FIXME reuse another field?  */
+  tree lambda_expr;
 };
 
 struct GTY(()) lang_type_ptrmem {
@@ -1221,6 +1388,11 @@ struct GTY(()) lang_type {
 #define CLASSTYPE_LAZY_COPY_CTOR(NODE) \
   (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_ctor)
 
+/* Nonzero means that NODE (a class type) has a move constructor --
+   but that it has not yet been declared.  */
+#define CLASSTYPE_LAZY_MOVE_CTOR(NODE) \
+  (LANG_TYPE_CLASS_CHECK (NODE)->lazy_move_ctor)
+
 /* Nonzero means that NODE (a class type) has an assignment operator
    -- but that it has not yet been declared.  */
 #define CLASSTYPE_LAZY_ASSIGNMENT_OP(NODE) \
@@ -1426,6 +1598,13 @@ struct GTY(()) lang_type {
 #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
   (LANG_TYPE_CLASS_CHECK (NODE)->befriending_classes)
 
+/* The associated LAMBDA_EXPR that made this class.  */
+#define CLASSTYPE_LAMBDA_EXPR(NODE) \
+  (LANG_TYPE_CLASS_CHECK (NODE)->lambda_expr)
+/* The extra mangling scope for this closure type.  */
+#define LAMBDA_TYPE_EXTRA_SCOPE(NODE) \
+  (LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR (NODE)))
+
 /* Say whether this node was declared as a "class" or a "struct".  */
 #define CLASSTYPE_DECLARED_CLASS(NODE) \
   (LANG_TYPE_CLASS_CHECK (NODE)->declared_class)
@@ -1551,13 +1730,18 @@ struct GTY(()) lang_type {
 /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
    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.  */
+   no exceptions allowed.  For a noexcept specification, TREE_VALUE
+   is NULL_TREE and TREE_PURPOSE is the constant-expression. */
 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_LANG_SLOT_1 (NODE)
 
-/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'.  */
-#define TYPE_NOTHROW_P(NODE) \
-  (TYPE_RAISES_EXCEPTIONS (NODE) \
-   && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE)
+/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'
+   or noexcept(true).  */
+#define TYPE_NOTHROW_P(NODE) nothrow_spec_p (TYPE_RAISES_EXCEPTIONS (NODE))
+
+/* For FUNCTION_TYPE or METHOD_TYPE, true if NODE is noexcept.  This is the
+   case for things declared noexcept(true) and, with -fnothrow-opt, for
+   throw() functions.  */
+#define TYPE_NOEXCEPT_P(NODE) type_noexcept_p (NODE)
 
 /* The binding level associated with the namespace.  */
 #define NAMESPACE_LEVEL(NODE) \
@@ -1578,9 +1762,10 @@ struct GTY(()) lang_decl_base {
   unsigned threadprivate_or_deleted_p : 1; /* var or fn */
   unsigned anticipated_p : 1;             /* fn or type */
   unsigned friend_attr : 1;               /* fn or type */
-  unsigned template_conv_p : 1;                   /* template only? */
+  unsigned template_conv_p : 1;                   /* var or template */
+  unsigned odr_used : 1;                  /* var or fn */
   unsigned u2sel : 1;
-  /* 2 spare bits */
+  /* 1 spare bit */
 };
 
 /* True for DECL codes which have template info and access.  */
@@ -1641,8 +1826,7 @@ struct GTY(()) lang_decl_fn {
   unsigned thunk_p : 1;
   unsigned this_thunk_p : 1;
   unsigned hidden_friend_p : 1;
-  unsigned deferred : 1;
-  /* No spare bits; consider adding to lang_decl_base instead.  */
+  /* 1 spare bit.  */
 
   /* For a non-thunk function decl, this is a tree list of
      friendly classes. For a thunk function decl, it is the
@@ -1740,7 +1924,7 @@ struct GTY(()) lang_decl {
 
 #define LANG_DECL_U2_CHECK(NODE, TF) __extension__             \
 ({  struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);          \
-    if (lt->u.base.u2sel != TF)                                        \
+    if (!LANG_DECL_HAS_MIN (NODE) || lt->u.base.u2sel != TF)   \
       lang_check_failed (__FILE__, __LINE__, __FUNCTION__);    \
     &lt->u.min.u2; })
 
@@ -1873,6 +2057,10 @@ struct GTY(()) lang_decl {
 /* Discriminator for name mangling.  */
 #define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator)
 
+/* True iff DECL_DISCRIMINATOR is set for a DECL_DISCRIMINATOR_P decl.  */
+#define DECL_DISCRIMINATOR_SET_P(NODE) \
+  (DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->u.base.u2sel == 1)
+
 /* The index of a user-declared parameter in its function, starting at 1.
    All artificial parameters will have index 0.  */
 #define DECL_PARM_INDEX(NODE) \
@@ -1904,6 +2092,15 @@ struct GTY(()) lang_decl {
 #define DECL_TEMPLATE_CONV_FN_P(NODE) \
   (DECL_LANG_SPECIFIC (TEMPLATE_DECL_CHECK (NODE))->u.base.template_conv_p)
 
+/* Nonzero if NODE, a static data member, was declared in its class as an
+   array of unknown bound.  */
+#define VAR_HAD_UNKNOWN_BOUND(NODE)                    \
+  (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))          \
+   ? DECL_LANG_SPECIFIC (NODE)->u.base.template_conv_p \
+   : false)
+#define SET_VAR_HAD_UNKNOWN_BOUND(NODE) \
+  (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.template_conv_p = true)
+
 /* Set the overloaded operator code for NODE to CODE.  */
 #define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \
   (LANG_DECL_FN_CHECK (NODE)->operator_code = (CODE))
@@ -1982,6 +2179,12 @@ struct GTY(()) lang_decl {
   (DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \
    ->u.base.initialized_in_class)
 
+/* Nonzero if the DECL is used in the sense of 3.2 [basic.def.odr].
+   Only available for decls with DECL_LANG_SPECIFIC.  */
+#define DECL_ODR_USED(DECL) \
+  (DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \
+   ->u.base.odr_used)
+
 /* Nonzero for DECL means that this decl is just a friend declaration,
    and should not be added to the list of members for this class.  */
 #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->u.base.friend_attr)
@@ -2085,6 +2288,10 @@ struct GTY(()) lang_decl {
 #define DECL_REPO_AVAILABLE_P(NODE) \
   (DECL_LANG_SPECIFIC (NODE)->u.base.repo_available_p)
 
+/* True if DECL is declared 'constexpr'.  */
+#define DECL_DECLARED_CONSTEXPR_P(DECL) \
+  DECL_LANG_FLAG_8 (VAR_OR_FUNCTION_DECL_CHECK (DECL))
+
 /* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
    template function.  */
 #define DECL_PRETTY_FUNCTION_P(NODE) \
@@ -2123,6 +2330,13 @@ struct GTY(()) lang_decl {
   (!DECL_TEMPLATE_PARM_P (NODE)                                        \
    && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
 
+#define TYPE_NAMESPACE_SCOPE_P(NODE) \
+  (TREE_CODE (CP_TYPE_CONTEXT (NODE)) == NAMESPACE_DECL)
+
+#define NAMESPACE_SCOPE_P(NODE) \
+  ((DECL_P (NODE) && DECL_NAMESPACE_SCOPE_P (NODE)) \
+   || (TYPE_P (NODE) && TYPE_NAMESPACE_SCOPE_P (NODE)))
+
 /* 1 iff NODE is a class member.  */
 #define DECL_CLASS_SCOPE_P(NODE) \
   (DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE)))
@@ -2135,6 +2349,9 @@ struct GTY(()) lang_decl {
   (DECL_CONTEXT (NODE) \
    && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
 
+#define TYPE_FUNCTION_SCOPE_P(NODE) \
+  (TYPE_CONTEXT (NODE) && TREE_CODE (TYPE_CONTEXT (NODE)) == FUNCTION_DECL)
+
 /* 1 iff VAR_DECL node NODE is a type-info decl.  This flag is set for
    both the primary typeinfo object and the associated NTBS name.  */
 #define DECL_TINFO_P(NODE) TREE_LANG_FLAG_4 (VAR_DECL_CHECK (NODE))
@@ -2228,10 +2445,6 @@ extern void decl_shadowed_for_var_insert (tree, tree);
 #define CLASSTYPE_SORTED_FIELDS(NODE) \
   (LANG_TYPE_CLASS_CHECK (NODE)->sorted_fields)
 
-/* True if on the deferred_fns (see decl2.c) list.  */
-#define DECL_DEFERRED_FN(DECL) \
-  (LANG_DECL_FN_CHECK (DECL)->deferred)
-
 /* If non-NULL for a VAR_DECL, FUNCTION_DECL, TYPE_DECL or
    TEMPLATE_DECL, the entity is either a template specialization (if
    DECL_USE_TEMPLATE is nonzero) or the abstract instance of the
@@ -2294,12 +2507,31 @@ extern void decl_shadowed_for_var_insert (tree, tree);
    ? (ENUM_TEMPLATE_INFO (NODE) = (VAL))       \
    : (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)))
 
-#define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
-#define TI_ARGS(NODE) (TREE_VALUE (NODE))
+#define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE))
+#define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE))
 #define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
+/* For a given TREE_VEC containing a template argument list,
+   this property contains the number of arguments that are not
+   defaulted.  */
+#define NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) TREE_CHAIN (TREE_VEC_CHECK (NODE))
+/* Below are the setter and getter of the NON_DEFAULT_TEMPLATE_ARGS_COUNT
+   property.  */
+#define SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE, INT_VALUE) \
+  NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) = build_int_cst (NULL_TREE, INT_VALUE)
+#ifdef ENABLE_CHECKING
+#define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \
+    int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE))
+#else
+#define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \
+  NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE) \
+  ? int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE)) \
+  : TREE_VEC_LENGTH (INNERMOST_TEMPLATE_ARGS (NODE))
+#endif
 /* The list of typedefs - used in the template - that need
    access checking at template instantiation time.  */
-#define TI_TYPEDEFS_NEEDING_ACCESS_CHECKING(NODE) (TREE_CHAIN (NODE))
+#define TI_TYPEDEFS_NEEDING_ACCESS_CHECKING(NODE) \
+  ((struct tree_template_info*)TEMPLATE_INFO_CHECK \
+     (NODE))->typedefs_needing_access_checking
 
 /* We use TREE_VECs to hold template arguments.  If there is only one
    level of template arguments, then the TREE_VEC contains the
@@ -2311,7 +2543,13 @@ extern void decl_shadowed_for_var_insert (tree, tree);
 
    It is incorrect to ever form a template argument vector containing
    only one level of arguments, but which is a TREE_VEC containing as
-   its only entry the TREE_VEC for that level.  */
+   its only entry the TREE_VEC for that level.
+
+   For each TREE_VEC containing the template arguments for a single
+   level, it's possible to get or set the number of non defaulted
+   template arguments by using the accessor macros
+   GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT or
+   SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT.  */
 
 /* Nonzero if the template arguments is actually a vector of vectors,
    rather than just a vector.  */
@@ -2620,6 +2858,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
   for ((arg) = first_aggr_init_expr_arg ((call), &(iter)); (arg);      \
        (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)
+
 /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
    TEMPLATE_DECL.  This macro determines whether or not a given class
    type is really a template type, as opposed to an instantiation or
@@ -2697,10 +2939,18 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define DECL_DELETED_FN(DECL) \
   (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.base.threadprivate_or_deleted_p)
 
-/* Nonzero if DECL was declared with '= default'.  */
+/* Nonzero if DECL was declared with '= default' (maybe implicitly).  */
 #define DECL_DEFAULTED_FN(DECL) \
   (LANG_DECL_FN_CHECK (DECL)->defaulted_p)
 
+/* Nonzero if DECL is explicitly defaulted in the class body.  */
+#define DECL_DEFAULTED_IN_CLASS_P(DECL)                                        \
+  (DECL_DEFAULTED_FN (DECL) && DECL_INITIALIZED_IN_CLASS_P (DECL))
+/* Nonzero if DECL was defaulted outside the class body.  */
+#define DECL_DEFAULTED_OUTSIDE_CLASS_P(DECL)                           \
+  (DECL_DEFAULTED_FN (DECL)                                            \
+   && !(DECL_ARTIFICIAL (DECL) || DECL_INITIALIZED_IN_CLASS_P (DECL)))
+
 /* Record whether a typedef for type `int' was actually `signed int'.  */
 #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
 
@@ -2739,6 +2989,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P(TYPE) \
    (UNSCOPED_ENUM_P (TYPE) || CP_INTEGRAL_TYPE_P (TYPE))
 
+/* True if the class type TYPE is a literal type.  */
+#define CLASSTYPE_LITERAL_P(TYPE)              \
+   (LANG_TYPE_CLASS_CHECK (TYPE)->is_literal)
+
 /* [basic.fundamental]
 
    Integral and floating types are collectively called arithmetic
@@ -2752,10 +3006,16 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
    || TREE_CODE (TYPE) == REAL_TYPE \
    || TREE_CODE (TYPE) == COMPLEX_TYPE)
 
+/* True iff TYPE is cv decltype(nullptr).  */
+#define NULLPTR_TYPE_P(TYPE)                           \
+  (TREE_CODE (TYPE) == LANG_TYPE                       \
+   && TYPE_MAIN_VARIANT (TYPE) == nullptr_type_node)
+
 /* [basic.types]
 
-   Arithmetic types, enumeration types, pointer types, and
-   pointer-to-member types, are collectively called scalar types.
+   Arithmetic types, enumeration types, pointer types,
+   pointer-to-member types, and std::nullptr_t are collectively called
+   scalar types.
    
    Keep these checks in ascending code order.  */
 #define SCALAR_TYPE_P(TYPE)                    \
@@ -2763,7 +3023,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
    || TREE_CODE (TYPE) == ENUMERAL_TYPE                \
    || ARITHMETIC_TYPE_P (TYPE)                 \
    || TYPE_PTR_P (TYPE)                                \
-   || TYPE_PTRMEMFUNC_P (TYPE))
+   || TYPE_PTRMEMFUNC_P (TYPE)                  \
+   || NULLPTR_TYPE_P (TYPE))
 
 /* Determines whether this type is a C++0x scoped enumeration
    type. Scoped enumerations types are introduced via "enum class" or
@@ -2786,17 +3047,17 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 
      - The underlying type of the enum is well-defined.  */
 #define SCOPED_ENUM_P(TYPE)                                             \
-  (TREE_CODE (TYPE) == ENUMERAL_TYPE && TYPE_LANG_FLAG_5 (TYPE))
+  (TREE_CODE (TYPE) == ENUMERAL_TYPE && ENUM_IS_SCOPED (TYPE))
 
 /* Determine whether this is an unscoped enumeration type.  */
 #define UNSCOPED_ENUM_P(TYPE)                                           \
-  (TREE_CODE (TYPE) == ENUMERAL_TYPE && !TYPE_LANG_FLAG_5 (TYPE))
+  (TREE_CODE (TYPE) == ENUMERAL_TYPE && !ENUM_IS_SCOPED (TYPE))
 
 /* Set the flag indicating whether an ENUMERAL_TYPE is a C++0x scoped
    enumeration type (1) or a normal (unscoped) enumeration type
    (0).  */
 #define SET_SCOPED_ENUM_P(TYPE, VAL)                    \
-  (TYPE_LANG_FLAG_5 (ENUMERAL_TYPE_CHECK (TYPE)) = (VAL))
+  (ENUM_IS_SCOPED (TYPE) = (VAL))
 
 /* Returns the underlying type of the given enumeration type. The
    underlying type is determined in different ways, depending on the
@@ -2951,10 +3212,6 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define TYPE_REF_OBJ_P(NODE)                                   \
   (TREE_CODE (NODE) == REFERENCE_TYPE && TYPE_OBJ_P (TREE_TYPE (NODE)))
 
-/* True if reference type NODE is an rvalue reference */
-#define TYPE_REF_IS_RVALUE(NODE) \
-  TREE_LANG_FLAG_0 (REFERENCE_TYPE_CHECK (NODE))
-
 /* Returns true if NODE is a pointer to an object, or a pointer to
    void.  Keep these checks in ascending tree code order.  */
 #define TYPE_PTROBV_P(NODE)                                    \
@@ -3053,6 +3310,14 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P(NODE) \
   (DECLTYPE_TYPE_CHECK (NODE))->type.string_flag
 
+/* These flags indicate that we want different semantics from normal
+   decltype: lambda capture just drops references, lambda return also does
+   type decay.  */
+#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))
+
 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
    specified in its declaration.  This can also be set for an
    erroneously declared PARM_DECL.  */
@@ -3070,6 +3335,12 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define DECL_FIELD_IS_BASE(NODE) \
   DECL_LANG_FLAG_6 (FIELD_DECL_CHECK (NODE))
 
+/* Nonzero for FIELD_DECL node means that this field is a simple (no
+   explicit initializer) lambda capture field, making it invisible to
+   name lookup in unevaluated contexts.  */
+#define DECL_NORMAL_CAPTURE_P(NODE) \
+  DECL_LANG_FLAG_7 (FIELD_DECL_CHECK (NODE))
+
 /* Nonzero if TYPE is an anonymous union or struct type.  We have to use a
    flag for this because "A union for which objects or pointers are
    declared is not an anonymous union" [class.union].  */
@@ -3082,8 +3353,6 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define ANON_UNION_TYPE_P(NODE) \
   (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
 
-#define UNKNOWN_TYPE LANG_TYPE
-
 /* Define fields and accessors for nodes representing declared names.  */
 
 #define TYPE_WAS_ANONYMOUS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous)
@@ -3281,7 +3550,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P(NODE)   \
   (CLASS_TYPE_P (NODE)                                         \
    && CLASSTYPE_USE_TEMPLATE (NODE)                            \
-   && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (arg)))  
+   && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
 
 #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
 #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
@@ -3504,6 +3773,16 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define TARGET_EXPR_LIST_INIT_P(NODE) \
   TREE_LANG_FLAG_1 (TARGET_EXPR_CHECK (NODE))
 
+/* True if this TARGET_EXPR expresses direct-initialization of an object
+   to be named later.  */
+#define TARGET_EXPR_DIRECT_INIT_P(NODE) \
+  TREE_LANG_FLAG_2 (TARGET_EXPR_CHECK (NODE))
+
+/* True if EXPR expresses direct-initialization of a TYPE.  */
+#define DIRECT_INIT_EXPR_P(TYPE,EXPR)                                  \
+  (TREE_CODE (EXPR) == TARGET_EXPR && TREE_LANG_FLAG_2 (EXPR)          \
+   && same_type_ignoring_top_level_qualifiers_p (TYPE, TREE_TYPE (EXPR)))
+
 /* An enumeration of the kind of tags that C++ accepts.  */
 enum tag_types {
   none_type = 0, /* Not a tag type.  */
@@ -3565,6 +3844,7 @@ typedef enum special_function_kind {
                              special_function_p.  */
   sfk_constructor,        /* A constructor.  */
   sfk_copy_constructor,    /* A copy constructor.  */
+  sfk_move_constructor,    /* A move constructor.  */
   sfk_assignment_operator, /* An assignment operator.  */
   sfk_destructor,         /* A destructor.  */
   sfk_complete_destructor, /* A destructor for complete objects.  */
@@ -3773,6 +4053,13 @@ extern GTY(()) VEC(tree,gc) *local_classes;
 #define VTABLE_DELTA_NAME      "__delta"
 #define VTABLE_PFN_NAME                "__pfn"
 
+#define LAMBDANAME_PREFIX "__lambda"
+#define LAMBDANAME_FORMAT LAMBDANAME_PREFIX "%d"
+#define LAMBDANAME_P(ID_NODE) \
+  (!strncmp (IDENTIFIER_POINTER (ID_NODE), \
+             LAMBDANAME_PREFIX, \
+            sizeof (LAMBDANAME_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' \
@@ -3802,7 +4089,7 @@ extern int at_eof;
    TREE_PURPOSE slot.  */
 extern GTY(()) tree static_aggregates;
 
-enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
+enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, TYPENAME_FLAG };
 
 /* These are uses as bits in flags passed to various functions to
    control their behavior.  Despite the LOOKUP_ prefix, many of these
@@ -3829,8 +4116,8 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
    have already generated a temporary, such as reference
    initialization and the catch parameter.  */
 #define DIRECT_BIND (1 << 4)
-/* User-defined conversions are not permitted.  (Built-in conversions
-   are permitted.)  */
+/* We're performing a user-defined conversion, so more user-defined
+   conversions are not permitted (only built-in conversions).  */
 #define LOOKUP_NO_CONVERSION (1 << 5)
 /* The user has explicitly called a destructor.  (Therefore, we do
    not need to check that the object is non-NULL before calling the
@@ -3857,6 +4144,8 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
 #define LOOKUP_NO_COPY_CTOR_CONVERSION (LOOKUP_NO_NARROWING << 1)
 /* This is the first parameter of a copy constructor.  */
 #define LOOKUP_COPY_PARM (LOOKUP_NO_COPY_CTOR_CONVERSION << 1)
+/* We only want to consider list constructors.  */
+#define LOOKUP_LIST_ONLY (LOOKUP_COPY_PARM << 1)
 
 #define LOOKUP_NAMESPACES_ONLY(F)  \
   (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
@@ -3894,8 +4183,8 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
 #define WANT_ENUM      4 /* enumerated types */
 #define WANT_POINTER   8 /* pointer types */
 #define WANT_NULL      16 /* null pointer constant */
-#define WANT_VECTOR    32 /* vector types */
-#define WANT_ARITH     (WANT_INT | WANT_FLOAT | WANT_VECTOR)
+#define WANT_VECTOR_OR_COMPLEX 32 /* vector or complex types */
+#define WANT_ARITH     (WANT_INT | WANT_FLOAT | WANT_VECTOR_OR_COMPLEX)
 
 /* Used with comptypes, and related functions, to guide type
    comparison.  */
@@ -3967,6 +4256,10 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
   (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
 #define TEMPLATE_TYPE_PARAMETER_PACK(NODE) \
   (TEMPLATE_PARM_PARAMETER_PACK (TEMPLATE_TYPE_PARM_INDEX (NODE)))
+/* The list of template parms that a given template parameter of type
+   TEMPLATE_TYPE_PARM belongs to.*/
+#define TEMPLATE_TYPE_PARM_SIBLING_PARMS(NODE) \
+  (TREE_CHECK ((NODE), TEMPLATE_TYPE_PARM))->type.maxval
 
 /* These constants can used as bit flags in the process of tree formatting.
 
@@ -3985,7 +4278,9 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
    TFF_EXPR_IN_PARENS: parenthesize expressions.
    TFF_NO_FUNCTION_ARGUMENTS: don't show function arguments.
    TFF_UNQUALIFIED_NAME: do not print the qualifying scope of the
-       top-level entity.  */
+       top-level entity.
+   TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS: do not omit template arguments
+       identical to their defaults.  */
 
 #define TFF_PLAIN_IDENTIFIER                   (0)
 #define TFF_SCOPE                              (1)
@@ -4000,6 +4295,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
 #define TFF_EXPR_IN_PARENS                     (1 << 9)
 #define TFF_NO_FUNCTION_ARGUMENTS              (1 << 10)
 #define TFF_UNQUALIFIED_NAME                   (1 << 11)
+#define TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS (1 << 12)
 
 /* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
    node.  */
@@ -4064,6 +4360,7 @@ typedef enum cp_decl_spec {
   ds_explicit,
   ds_friend,
   ds_typedef,
+  ds_constexpr,
   ds_complex,
   ds_thread,
   ds_last
@@ -4074,14 +4371,14 @@ typedef enum cp_decl_spec {
 typedef struct cp_decl_specifier_seq {
   /* The number of times each of the keywords has been seen.  */
   unsigned specs[(int) ds_last];
+  /* The location of the primary type. Mainly used for error
+     reporting.  */
+  location_t type_location;
   /* The primary type, if any, given by the decl-specifier-seq.
      Modifiers, like "short", "const", and "unsigned" are not
      reflected here.  This field will be a TYPE, unless a typedef-name
      was used, in which case it will be a TYPE_DECL.  */
   tree type;
-  /* The location of the primary type. Mainly used for error
-     reporting.  */
-  location_t type_location;
   /* The attributes, if any, provided with the specifier sequence.  */
   tree attributes;
   /* If non-NULL, a built-in type that the user attempted to redefine
@@ -4101,8 +4398,12 @@ typedef struct cp_decl_specifier_seq {
   BOOL_BITFIELD conflicting_specifiers_p : 1;
   /* True iff at least one decl-specifier was found.  */
   BOOL_BITFIELD any_specifiers_p : 1;
+  /* True iff at least one type-specifier was found.  */
+  BOOL_BITFIELD any_type_specifiers_p : 1;
   /* True iff "int" was explicitly provided.  */
   BOOL_BITFIELD explicit_int_p : 1;
+  /* True iff "__int128" was explicitly provided.  */
+  BOOL_BITFIELD explicit_int128_p : 1;
   /* True iff "char" was explicitly provided.  */
   BOOL_BITFIELD explicit_char_p : 1;
 } cp_decl_specifier_seq;
@@ -4147,12 +4448,12 @@ struct cp_declarator {
   /* Whether we parsed an ellipsis (`...') just before the declarator,
      to indicate this is a parameter pack.  */
   BOOL_BITFIELD parameter_pack_p : 1;
+  location_t id_loc; /* Currently only set for cdk_id and cdk_function. */
   /* Attributes that apply to this declarator.  */
   tree attributes;
   /* For all but cdk_id and cdk_error, the contained declarator.  For
      cdk_id and cdk_error, guaranteed to be NULL.  */
   cp_declarator *declarator;
-  location_t id_loc; /* Currently only set for cdk_id and cdk_function. */
   union {
     /* For identifiers.  */
     struct {
@@ -4263,7 +4564,7 @@ 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 *);
+extern tree initialize_reference               (tree, tree, tree, tree *, tsubst_flags_t);
 extern tree make_temporary_var_for_ref_to_temp (tree, tree);
 extern tree strip_top_quals                    (tree);
 extern bool reference_related_p                        (tree, tree);
@@ -4283,7 +4584,8 @@ extern void validate_conversion_obstack           (void);
 extern tree build_vfield_ref                   (tree, tree);
 extern tree build_base_path                    (enum tree_code, tree,
                                                 tree, int);
-extern tree convert_to_base                    (tree, tree, bool, bool);
+extern tree convert_to_base                    (tree, tree, bool, bool,
+                                                tsubst_flags_t);
 extern tree convert_to_base_statically         (tree, tree);
 extern tree build_vtbl_ref                     (tree, tree);
 extern tree build_vfn_ref                      (tree, tree);
@@ -4293,6 +4595,7 @@ extern void resort_type_method_vec                (void *, void *,
 extern bool add_method                         (tree, tree, tree);
 extern bool currently_open_class               (tree);
 extern tree currently_open_derived_class       (tree);
+extern tree current_nonlambda_class_type       (void);
 extern tree finish_struct                      (tree, tree);
 extern void finish_struct_1                    (tree);
 extern int resolves_to_fixed_type_p            (tree, int *);
@@ -4325,9 +4628,12 @@ extern void check_for_override                   (tree, tree);
 extern void push_class_stack                   (void);
 extern void pop_class_stack                    (void);
 extern bool type_has_user_nondefault_constructor (tree);
+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 defaultable_fn_p                   (tree);
+extern void defaulted_late_check               (tree);
+extern bool defaultable_fn_check               (tree);
 extern void fixup_type_variants                        (tree);
 extern tree* decl_cloned_function_p            (const_tree, bool);
 extern void clone_function_decl                        (tree, int);
@@ -4349,7 +4655,6 @@ extern tree type_promotes_to                      (tree);
 extern tree perform_qualification_conversions  (tree, tree);
 
 /* in name-lookup.c */
-extern tree get_anonymous_namespace_name       (void);
 extern tree pushdecl                           (tree);
 extern tree pushdecl_maybe_friend              (tree, bool);
 extern void maybe_push_cleanup_level           (tree);
@@ -4360,6 +4665,7 @@ 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 tree maybe_push_decl                    (tree);
+extern tree current_decl_namespace             (void);
 
 /* decl.c */
 extern tree poplevel                           (int, int, int);
@@ -4369,6 +4675,7 @@ enum cp_tree_node_structure_enum cp_tree_node_structure
 extern void finish_scope                       (void);
 extern void push_switch                                (tree);
 extern void pop_switch                         (void);
+extern tree make_lambda_name                   (void);
 extern int decls_match                         (tree, tree);
 extern tree duplicate_decls                    (tree, tree, bool);
 extern tree declare_local_label                        (tree);
@@ -4413,12 +4720,12 @@ extern tree begin_function_body                 (void);
 extern void finish_function_body               (tree);
 extern tree outer_curly_brace_block            (tree);
 extern tree finish_function                    (int);
-extern tree start_method                       (cp_decl_specifier_seq *, const cp_declarator *, tree);
-extern tree finish_method                      (tree);
+extern tree grokmethod                         (cp_decl_specifier_seq *, const cp_declarator *, tree);
 extern void maybe_register_incomplete_var      (tree);
 extern void maybe_commonize_var                        (tree);
 extern void complete_vars                      (tree);
 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);
@@ -4439,9 +4746,10 @@ extern tree check_elaborated_type_specifier      (enum tag_types, tree, bool);
 extern void warn_extern_redeclared_static      (tree, tree);
 extern tree cxx_comdat_group                   (tree);
 extern bool cp_missing_noreturn_ok_p           (tree);
-extern void initialize_artificial_var          (tree, 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 next_initializable_field (tree);
 
 extern bool defer_mark_used_calls;
 extern GTY(()) VEC(tree, gc) *deferred_mark_used_calls;
@@ -4451,8 +4759,10 @@ extern tree cxx_maybe_build_cleanup              (tree);
 /* in decl2.c */
 extern bool check_java_method                  (tree);
 extern tree build_memfn_type                   (tree, tree, cp_cv_quals);
+extern tree change_return_type                 (tree, tree);
 extern void maybe_retrofit_in_chrg             (tree);
 extern void maybe_make_one_only                        (tree);
+extern bool vague_linkage_p                    (tree);
 extern void grokclassfn                                (tree, tree,
                                                 enum overload_flags);
 extern tree grok_array_decl                    (tree, tree);
@@ -4477,7 +4787,6 @@ extern tree build_cleanup                 (tree);
 extern tree build_offset_ref_call_from_tree    (tree, VEC(tree,gc) **);
 extern void check_default_args                 (tree);
 extern void mark_used                          (tree);
-extern bool tree_used_ok                       (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);
@@ -4503,8 +4812,8 @@ extern const char *language_to_string             (enum languages);
 extern const char *class_key_or_enum_as_string (tree);
 extern void print_instantiation_context                (void);
 extern void maybe_warn_variadic_templates       (void);
-extern void maybe_warn_cpp0x                   (const char *);
-extern bool pedwarn_cxx98                       (location_t, int, const char *, ...) ATTRIBUTE_GCC_CXXDIAG(3,4);
+extern void maybe_warn_cpp0x                   (cpp0x_warn_str str);
+extern bool pedwarn_cxx98                       (location_t, int, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4);
 
 /* in except.c */
 extern void init_exception_processing          (void);
@@ -4514,13 +4823,23 @@ extern tree build_exc_ptr                       (void);
 extern tree build_throw                                (tree);
 extern int nothrow_libfn_p                     (const_tree);
 extern void check_handlers                     (tree);
+extern tree finish_noexcept_expr               (tree);
+extern bool nothrow_spec_p                     (const_tree);
+extern bool type_noexcept_p                    (const_tree);
+extern bool type_throw_all_p                   (const_tree);
+extern tree build_noexcept_spec                        (tree, int);
 extern void choose_personality_routine         (enum languages);
 extern tree eh_type_info                       (tree);
 extern tree begin_eh_spec_block                        (void);
 extern void finish_eh_spec_block               (tree, tree);
+extern tree build_eh_type_type                 (tree);
 
 /* in expr.c */
 extern tree cplus_expand_constant              (tree);
+extern tree mark_rvalue_use                    (tree);
+extern tree mark_lvalue_use                    (tree);
+extern tree mark_type_use                      (tree);
+extern void mark_exp_read                      (tree);
 
 /* friend.c */
 extern int is_friend                           (tree, tree);
@@ -4554,6 +4873,7 @@ 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 int diagnose_uninitialized_cst_or_ref_member (tree, bool, bool);
 
 /* in lex.c */
 extern void cxx_dup_lang_specific_decl         (tree);
@@ -4605,13 +4925,15 @@ extern tree check_explicit_specialization       (tree, tree, int, int);
 extern tree make_auto                          (void);
 extern tree do_auto_deduction                  (tree, tree, tree);
 extern tree type_uses_auto                     (tree);
-extern void append_type_to_template_for_access_check (tree, tree, tree);
+extern void append_type_to_template_for_access_check (tree, tree, tree,
+                                                     location_t);
 extern tree splice_late_return_type            (tree, tree);
 extern bool is_auto                            (const_tree);
 extern tree process_template_parm              (tree, location_t, tree, 
                                                 bool, bool);
 extern tree end_template_parm_list             (tree);
 extern void end_template_decl                  (void);
+extern tree maybe_update_decl_type             (tree, tree);
 extern bool check_default_tmpl_args             (tree, tree, int, int, int);
 extern tree push_template_decl                 (tree);
 extern tree push_template_decl_real            (tree, bool);
@@ -4635,13 +4957,17 @@ extern tree instantiate_decl                    (tree, int, bool);
 extern int comp_template_parms                 (const_tree, const_tree);
 extern bool uses_parameter_packs                (tree);
 extern bool template_parameter_pack_p           (const_tree);
+extern bool function_parameter_pack_p          (const_tree);
+extern bool function_parameter_expanded_from_pack_p (tree, tree);
 extern tree make_pack_expansion                 (tree);
 extern bool check_for_bare_parameter_packs      (tree);
-extern tree get_template_info                  (tree);
-extern tree get_types_needing_access_check     (tree);
+extern tree build_template_info                        (tree, tree);
+extern tree get_template_info                  (const_tree);
+extern VEC(qualified_typedef_usage_t,gc)* get_types_needing_access_check (tree);
 extern int template_class_depth                        (tree);
 extern int is_specialization_of                        (tree, tree);
 extern bool is_specialization_of_friend                (tree, tree);
+extern tree get_pattern_parm                   (tree, tree);
 extern int comp_template_args                  (tree, tree);
 extern tree maybe_process_partial_specialization (tree);
 extern tree most_specialized_instantiation     (tree);
@@ -4676,9 +5002,20 @@ 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 explicit_class_specialization_p     (tree);
+extern int push_tinst_level                     (tree);
+extern void pop_tinst_level                     (void);
 extern struct tinst_level *outermost_tinst_level(void);
 extern bool parameter_of_template_p            (tree, tree);
 extern void init_template_processing           (void);
+extern void print_template_statistics          (void);
+bool template_template_parameter_p             (const_tree);
+extern bool primary_template_instantiation_p    (const_tree);
+extern tree get_primary_template_innermost_parameters  (const_tree);
+extern tree get_template_parms_at_level (tree, int);
+extern tree get_template_innermost_arguments   (const_tree);
+extern tree get_template_argument_pack_elems   (const_tree);
+extern tree get_function_template_decl         (const_tree);
+extern tree resolve_nondeduced_context         (tree);
 
 /* in repo.c */
 extern void init_repo                          (void);
@@ -4722,7 +5059,7 @@ extern int at_function_scope_p                    (void);
 extern bool at_class_scope_p                   (void);
 extern bool at_namespace_scope_p               (void);
 extern tree context_for_name_lookup            (tree);
-extern tree lookup_conversions                 (tree);
+extern tree lookup_conversions                 (tree, bool);
 extern tree binfo_from_vbase                   (tree);
 extern tree binfo_for_vbase                    (tree, tree);
 extern tree look_for_overrides_here            (tree, tree);
@@ -4803,6 +5140,9 @@ extern tree begin_handler                 (void);
 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 ensure_literal_type_for_constexpr_object (tree);
 
 enum {
   BCS_NO_SCOPE = 1,
@@ -4812,7 +5152,8 @@ enum {
 extern tree begin_compound_stmt                        (unsigned int);
 
 extern void finish_compound_stmt               (tree);
-extern tree finish_asm_stmt                    (int, tree, tree, tree, tree);
+extern tree finish_asm_stmt                    (int, tree, tree, tree, tree,
+                                                tree);
 extern tree finish_label_stmt                  (tree);
 extern void finish_label_decl                  (tree);
 extern tree finish_parenthesized_expr          (tree);
@@ -4821,6 +5162,7 @@ extern tree begin_stmt_expr                       (void);
 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) *);
 extern tree finish_call_expr                   (tree, VEC(tree,gc) **, bool,
                                                 bool, tsubst_flags_t);
@@ -4853,7 +5195,10 @@ extern void finish_eh_cleanup                    (tree);
 extern void emit_associated_thunks             (tree);
 extern void finish_mem_initializers            (tree);
 extern tree check_template_template_default_arg (tree);
+extern bool expand_or_defer_fn_1               (tree);
 extern void expand_or_defer_fn                 (tree);
+extern void add_typedef_to_current_template_for_access_check (tree, tree,
+                                                             location_t);
 extern void check_accessibility_of_qualified_id (tree, tree, tree);
 extern tree finish_qualified_id_expr           (tree, tree, bool, bool,
                                                 bool, bool);
@@ -4881,8 +5226,22 @@ extern void finish_static_assert                (tree, tree, location_t,
 extern tree describable_type                   (tree);
 extern tree finish_decltype_type                (tree, bool);
 extern tree finish_trait_expr                  (enum cp_trait_kind, tree, tree);
+extern tree build_lambda_expr                   (void);
+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_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 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);
 
 /* in tree.c */
+void cp_free_lang_data                                 (tree t);
 extern tree force_target_expr                  (tree, tree);
 extern tree build_target_expr_with_type                (tree, tree);
 extern void lang_check_failed                  (const char *, int,
@@ -4902,6 +5261,7 @@ extern bool type_has_nontrivial_copy_init (const_tree);
 extern bool class_tmpl_impl_spec_p             (const_tree);
 extern int zero_init_p                         (const_tree);
 extern tree strip_typedefs                     (tree);
+extern void cp_set_underlying_type             (tree);
 extern tree copy_binfo                         (tree, tree, tree,
                                                 tree *, int);
 extern int member_p                            (const_tree);
@@ -4917,10 +5277,12 @@ extern tree build_aggr_init_expr                (tree, tree);
 extern tree get_target_expr                    (tree);
 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 hash_tree_cons                     (tree, tree, tree);
 extern tree hash_tree_chain                    (tree, tree);
 extern tree build_qualified_name               (tree, tree, tree, bool);
 extern int is_overloaded_fn                    (tree);
+extern tree get_fns                            (tree);
 extern tree get_first_fn                       (tree);
 extern tree ovl_cons                           (tree, tree);
 extern tree build_overload                     (tree, tree);
@@ -4948,9 +5310,12 @@ extern const struct attribute_spec cxx_attribute_table[];
 extern tree make_ptrmem_cst                    (tree, tree);
 extern tree cp_build_type_attribute_variant     (tree, tree);
 extern tree cp_build_reference_type            (tree, bool);
+extern tree move                               (tree);
 extern tree cp_build_qualified_type_real       (tree, int, tsubst_flags_t);
 #define cp_build_qualified_type(TYPE, QUALS) \
   cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error)
+extern bool cv_qualified_p                     (const_tree);
+extern tree cv_unqualified                     (tree);
 extern special_function_kind special_function_p (const_tree);
 extern int count_trees                         (tree);
 extern int char_type_p                         (tree);
@@ -4989,7 +5354,8 @@ extern tree require_complete_type         (tree);
 extern tree complete_type                      (tree);
 extern tree complete_type_or_else              (tree, tree);
 extern int type_unknown_p                      (const_tree);
-extern bool comp_except_specs                  (const_tree, const_tree, bool);
+enum { ce_derived, ce_normal, ce_exact };
+extern bool comp_except_specs                  (const_tree, const_tree, int);
 extern bool comptypes                          (tree, tree, int);
 extern bool compparms                          (const_tree, const_tree);
 extern int comp_cv_qualification               (const_tree, const_tree);
@@ -5004,13 +5370,17 @@ extern tree build_class_member_access_expr      (tree, tree, tree, bool,
                                                 tsubst_flags_t);
 extern tree finish_class_member_access_expr     (tree, tree, bool, 
                                                 tsubst_flags_t);
-extern tree build_x_indirect_ref               (tree, const char *
+extern tree build_x_indirect_ref               (tree, ref_operator
                                                  tsubst_flags_t);
-extern tree cp_build_indirect_ref              (tree, const char *,
+extern tree cp_build_indirect_ref              (tree, ref_operator,
                                                  tsubst_flags_t);
 extern tree build_array_ref                    (location_t, tree, tree);
+extern tree cp_build_array_ref                 (location_t, tree, tree,
+                                                tsubst_flags_t);
 extern tree get_member_function_from_ptrfunc   (tree *, tree);
 extern tree cp_build_function_call              (tree, tree, tsubst_flags_t);
+extern tree cp_build_function_call_nary         (tree, tsubst_flags_t, ...)
+                                               ATTRIBUTE_SENTINEL;
 extern tree cp_build_function_call_vec         (tree, VEC(tree,gc) **,
                                                 tsubst_flags_t);
 extern tree build_x_binary_op                  (enum tree_code, tree,
@@ -5044,10 +5414,12 @@ extern tree convert_for_initialization          (tree, tree, tree, int,
                                                  tsubst_flags_t);
 extern int comp_ptr_ttypes                     (tree, tree);
 extern bool comp_ptr_ttypes_const              (tree, tree);
+extern bool error_type_p                       (const_tree);
 extern int ptr_reasonably_similar              (const_tree, const_tree);
 extern tree build_ptrmemfunc                   (tree, tree, int, bool);
 extern int cp_type_quals                       (const_tree);
-extern bool cp_type_readonly                   (const_tree);
+extern int type_memfn_quals                    (const_tree);
+extern tree apply_memfn_quals                  (tree, cp_cv_quals);
 extern bool cp_has_mutable_p                   (const_tree);
 extern bool at_least_as_qualified_p            (const_tree, const_tree);
 extern void cp_apply_type_quals_to_decl                (int, tree);
@@ -5056,8 +5428,10 @@ extern void expand_ptrmemfunc_cst                (tree, tree *, tree *);
 extern tree type_after_usual_arithmetic_conversions (tree, tree);
 extern tree common_pointer_type                 (tree, tree);
 extern tree composite_pointer_type             (tree, tree, tree, tree,
-                                                const char*, tsubst_flags_t);
+                                                composite_pointer_operation, 
+                                                tsubst_flags_t);
 extern tree merge_types                                (tree, tree);
+extern tree strip_array_domain                 (tree);
 extern tree check_return_expr                  (tree, bool *);
 extern tree cp_build_binary_op                  (location_t,
                                                 enum tree_code, tree, tree,
@@ -5085,7 +5459,7 @@ extern void cxx_incomplete_type_error             (const_tree, const_tree);
   (cxx_incomplete_type_diagnostic ((V), (T), DK_ERROR))
 extern tree error_not_base_type                        (tree, tree);
 extern tree binfo_or_else                      (tree, tree);
-extern void readonly_error                     (tree, const char *);
+extern void readonly_error                     (tree, readonly_error_kind);
 extern void complete_type_check_abstract       (tree);
 extern int abstract_virtuals_error             (tree, tree);
 
@@ -5103,7 +5477,7 @@ extern tree merge_exception_specifiers            (tree, tree);
 /* in mangle.c */
 extern void init_mangle                                (void);
 extern void mangle_decl                                (tree);
-extern const char *mangle_type_string_for_rtti (tree);
+extern const char *mangle_type_string          (tree);
 extern tree mangle_typeinfo_for_type           (tree);
 extern tree mangle_typeinfo_string_for_type    (tree);
 extern tree mangle_vtbl_for_type               (tree);
@@ -5121,7 +5495,6 @@ extern bool cp_dump_tree                  (void *, tree);
 
 extern alias_set_type cxx_get_alias_set                (tree);
 extern bool cxx_warn_unused_global_decl                (const_tree);
-extern tree cp_expr_size                       (const_tree);
 extern size_t cp_tree_size                     (enum tree_code);
 extern bool cp_var_mod_type_p                  (tree, tree);
 extern void cxx_initialize_diagnostics         (struct diagnostic_context *);