From 770ec066b8b5d70921dfab9fcd1bbb87abeb0dc5 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 3 Nov 2020 08:35:53 -0800 Subject: [PATCH] c++: Make extern-C mismatch an error duplicate_decls was being lenient about extern-c mismatches, allowing you to have two declarations in the symbol table after emitting an error. This resulted in duplicate error messages in modules, when we find the same problem multiple times. Let's just not let that happen. gcc/cp/ * decl.c (duplicate_decls): Return error_mark_node fo extern-c mismatch. --- gcc/cp/decl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 114e8d0cb01..9428fa05258 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1776,7 +1776,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden) newdecl); inform (olddecl_loc, "previous declaration %q#D", olddecl); - return NULL_TREE; + return error_mark_node; } /* For function versions, params and types match, but they are not ambiguous. */ -- 2.30.2