From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3726 invoked by alias); 16 Oct 2012 10:49:43 -0000 Received: (qmail 3676 invoked by uid 48); 16 Oct 2012 10:49:24 -0000 From: "paolo.carlini at oracle dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/51786] [c++0x] Invalid declaration with decltype accepted Date: Tue, 16 Oct 2012 10:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: paolo.carlini at oracle dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg01460.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51786 --- Comment #5 from Paolo Carlini 2012-10-16 10:49:22 UTC --- The problem is that by the time at the end of cp_parser_simple_declaration we call check_tag_decl (via shadow_tag), which is supposed to check that the simple declaration is valid, we already called finish_decltype_type thus it doesn't see the decltype, it sees something like: void foo() { struct A; } a valid simple declaration.