From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 81BD1386F47A; Fri, 12 Jun 2020 14:42:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81BD1386F47A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591972952; bh=EQyQU4ooFH5R1aD2kSNFL3ghAjIl8tyDyeZixsIy0bE=; h=From:To:Subject:Date:From; b=rgtnrtptVtv+JYrNLOO0PPNDPpMcpmwhLi7lks3lNGjSmQbPZT6K4AxMr7ZvCWPHZ VgcQ+kfZWcJqgJkvZasw8hDNtIzOVmkFy0rOwAs9hb7K577De5O9tEodvifYyifpk1 pZgZerryw9YZJsbjANodS2OrJLPSBCYIb88eenrQ= From: "haoxintu at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95657] New: Bogus error message in "auto" with -std=c++11 Date: Fri, 12 Jun 2020 14:42:32 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: haoxintu at gmail dot com 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: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jun 2020 14:42:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95657 Bug ID: 95657 Summary: Bogus error message in "auto" with -std=3Dc++11 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- This code bug.cc decltype (auto) foo( decltype (auto) a ){ } in GCC-trunk $g++ -c -std=3Dc++11 bug.cc bug.cc:1:11: error: expected primary-expression before =E2=80=98auto=E2=80= =99 1 | decltype (auto) foo( decltype (auto) a ){ } | ^~~~ bug.cc:1:33: error: use of =E2=80=98auto=E2=80=99 in parameter declaration = only available with =E2=80=98-std=3Dc++14=E2=80=99 or =E2=80=98-std=3Dgnu++14=E2=80=99 1 | decltype (auto) foo( decltype (auto) a ){ } | ^~~~ bug.cc:1:33: error: use of =E2=80=98auto=E2=80=99 in parameter declaration = only available with =E2=80=98-std=3Dc++14=E2=80=99 or =E2=80=98-std=3Dgnu++14=E2=80=99 bug.cc:1:33: error: use of =E2=80=98auto=E2=80=99 in parameter declaration = only available with =E2=80=98-std=3Dc++14=E2=80=99 or =E2=80=98-std=3Dgnu++14=E2=80=99 bug.cc:1:33: error: use of =E2=80=98auto=E2=80=99 in parameter declaration = only available with =E2=80=98-std=3Dc++14=E2=80=99 or =E2=80=98-std=3Dgnu++14=E2=80=99 bug.cc:1:33: error: use of =E2=80=98auto=E2=80=99 in parameter declaration = only available with =E2=80=98-std=3Dc++14=E2=80=99 or =E2=80=98-std=3Dgnu++14=E2=80=99 bug.cc:1:33: error: use of =E2=80=98auto=E2=80=99 in parameter declaration = only available with =E2=80=98-std=3Dc++14=E2=80=99 or =E2=80=98-std=3Dgnu++14=E2=80=99 bug.cc:1:33: error: expected primary-expression before =E2=80=98auto=E2=80= =99 bug.cc:1:22: error: expected primary-expression before =E2=80=98decltype=E2= =80=99 1 | decltype (auto) foo( decltype (auto) a ){ } | ^~~~~~~~~~~~~~~~ I am sure there were some duplicate error messages about "error: use of =E2= =80=98auto=E2=80=99 in parameter declaration only available with =E2=80=98-std=3Dc++14=E2=80=99= or =E2=80=98-std=3Dgnu++14=E2=80=99". While in clang $clang++ -c -std=3Dc++11 bug.cc bug.cc:1:11: warning: 'decltype(auto)' type specifier is a C++14 extension [-Wc++14-extensions] decltype (auto) foo( decltype (auto) a ){ } ^ bug.cc:1:33: warning: 'decltype(auto)' type specifier is a C++14 extension [-Wc++14-extensions] decltype (auto) foo( decltype (auto) a ){ } ^ bug.cc:1:22: error: 'decltype(auto)' not allowed in function prototype decltype (auto) foo( decltype (auto) a ){ } ^~~~~~~~ bug.cc:1:1: error: deduced return types are a C++14 extension decltype (auto) foo( decltype (auto) a ){ } ^ 2 warnings and 2 errors generated.=