summaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5906653f0d6..c93c7831a08 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1926,9 +1926,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* Merge the data types specified in the two decls. */
newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
- /* If merge_types produces a non-typedef type, just use the old type. */
- if (TREE_CODE (newdecl) == TYPE_DECL
- && newtype == DECL_ORIGINAL_TYPE (newdecl))
+ /* For typedefs use the old type, as the new type's DECL_NAME points
+ at newdecl, which will be ggc_freed. */
+ if (TREE_CODE (newdecl) == TYPE_DECL)
newtype = oldtype;
if (VAR_P (newdecl))
@@ -7674,7 +7674,7 @@ grokfndecl (tree ctype,
if (TYPE_NOTHROW_P (type) || nothrow_libfn_p (decl))
TREE_NOTHROW (decl) = 1;
- if (flag_openmp)
+ if (flag_openmp || flag_cilkplus)
{
/* Adjust "omp declare simd" attributes. */
tree ods = lookup_attribute ("omp declare simd", *attrlist);
@@ -8262,7 +8262,9 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
abi_1_itype = error_mark_node;
}
- size = maybe_constant_value (size);
+ if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
+ size = maybe_constant_value (size);
+
if (!TREE_CONSTANT (size))
size = osize;
}
@@ -9599,9 +9601,14 @@ grokdeclarator (const cp_declarator *declarator,
&& LAMBDA_TYPE_P (current_class_type))
/* OK for C++11 lambdas. */;
else if (cxx_dialect < cxx1y)
- pedwarn (input_location, 0, "%qs function uses "
+ {
+ error ("%qs function uses "
"%<auto%> type specifier without trailing "
"return type", name);
+ inform (input_location, "deduced return type "
+ "only available with -std=c++1y or "
+ "-std=gnu++1y");
+ }
else if (virtualp)
permerror (input_location, "virtual function cannot "
"have deduced return type");
@@ -14000,6 +14007,8 @@ finish_function (int flags)
&& !current_function_returns_value && !current_function_returns_null
/* Don't complain if we abort or throw. */
&& !current_function_returns_abnormally
+ /* Don't complain if there's an infinite loop. */
+ && !current_function_infinite_loop
/* Don't complain if we are declared noreturn. */
&& !TREE_THIS_VOLATILE (fndecl)
&& !DECL_NAME (DECL_RESULT (fndecl))
@@ -14064,6 +14073,7 @@ finish_function (int flags)
f->x_return_value = NULL;
f->bindings = NULL;
f->extern_decl_map = NULL;
+ f->infinite_loops = NULL;
}
/* Clear out the bits we don't need. */
local_names = NULL;