From 71e377d6eead9cf27bee1b1e3cf5d38175401e89 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sat, 17 Jan 2015 02:33:17 +0000 Subject: If a function decl cannot be merged, mark it as invalid. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clang currently crashes on class C { C() = default; C() = delete; }; My cunning plan for fixing this was to change the `if (!FnD)` in Parser::ParseCXXInlineMethodDef() to `if (!FnD || FnD->isInvalidDecl)` – but alas, the second constructor decl wasn't marked as invalid. This lets Sema::MergeFunctionDecl() return true on function redeclarations, which leads to them being marked invalid. This also improves error messages when functions are redeclared. llvm-svn: 226365 --- clang/test/Parser/cxx0x-ambig.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/test/Parser/cxx0x-ambig.cpp') diff --git a/clang/test/Parser/cxx0x-ambig.cpp b/clang/test/Parser/cxx0x-ambig.cpp index b06f432c435..a47585f8b64 100644 --- a/clang/test/Parser/cxx0x-ambig.cpp +++ b/clang/test/Parser/cxx0x-ambig.cpp @@ -110,8 +110,8 @@ namespace ellipsis { template struct S { void e(S::S()); - void f(S(...args[sizeof(T)])); // expected-note {{here}} - void f(S(...args)[sizeof(T)]); // expected-error {{redeclared}} expected-note {{here}} + void f(S(...args[sizeof(T)])); // expected-note {{here}} expected-note {{here}} + void f(S(...args)[sizeof(T)]); // expected-error {{redeclared}} void f(S ...args[sizeof(T)]); // expected-error {{redeclared}} void g(S(...[sizeof(T)])); // expected-note {{here}} expected-warning {{ISO C++11 requires a parenthesized pack declaration to have a name}} void g(S(...)[sizeof(T)]); // expected-error {{function cannot return array type}} -- cgit v1.2.3