From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5690 invoked by alias); 9 Oct 2015 16:46:29 -0000 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 Received: (qmail 5660 invoked by uid 48); 9 Oct 2015 16:46:25 -0000 From: "guille at cal dot berkeley.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/67910] New: Two autos in a single function confuses the type system Date: Fri, 09 Oct 2015 16:46:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 5.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: guille at cal dot berkeley.edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-10/txt/msg00712.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67910 Bug ID: 67910 Summary: Two autos in a single function confuses the type system Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: guille at cal dot berkeley.edu Target Milestone: --- The following code does not compile on 5.2.0: struct A {}; struct B {}; static auto f(auto b) -> A { return A(); } int main() { A a = f(B()); return 0; } whereas the following *does* compile: struct A {}; struct B {}; static auto f(B b) -> A { return A(); } int main() { __attribute__((unused)) A a = f(B()); return 0; } In the first (failing) case, the type system thinks that 'f' returns the same type as the first auto *argument*, even though the return type is specified to be 'A'.