aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2022-01-04 12:45:36 -0800
committerNathan Sidwell <nathan@acm.org>2022-01-05 04:04:01 -0800
commitf2da9e26f5c0f04d48872938eff130e2028e75d3 (patch)
tree21c2313a06f78ad1d13a54720a6fc7ef52d4ef81 /gcc/cp
parent77e71619532c7cd27e907bb22af157b8e56dca58 (diff)
downloadgcc-f2da9e26f5c0f04d48872938eff130e2028e75d3.zip
gcc-f2da9e26f5c0f04d48872938eff130e2028e75d3.tar.gz
gcc-f2da9e26f5c0f04d48872938eff130e2028e75d3.tar.bz2
Fix diagnostic recursion ICE
The [with T = $TYPE] diagnostic machinery must not cause recursion. So let's not unilaterally warn about new alignment. (template extracted from Open3D.) gcc/cp/ * init.c (build_new_1): Check complain before alignment warning. gcc/testsuite/ * g++.dg/diagnostic/recur-align.C: New.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/init.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 3f56ca4..9d616f3 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -3408,7 +3408,8 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
= (type_num_arguments (TREE_TYPE (alloc_fn)) > 1
|| varargs_function_p (alloc_fn));
- if (warn_aligned_new
+ if (complain & tf_warning_or_error
+ && warn_aligned_new
&& !placement_allocation_fn_p
&& TYPE_ALIGN (elt_type) > malloc_alignment ()
&& (warn_aligned_new > 1