From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30692 invoked by alias); 27 Jul 2015 20:36:41 -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 30665 invoked by uid 48); 27 Jul 2015 20:36:37 -0000 From: "ed at catmur dot co.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/67033] New: [c++11] template argument invalid for integral constant expression beginning with address-of expression Date: Mon, 27 Jul 2015 20:36: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: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ed at catmur dot co.uk 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-07/txt/msg02388.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67033 Bug ID: 67033 Summary: [c++11] template argument invalid for integral constant expression beginning with address-of expression Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ed at catmur dot co.uk Target Milestone: --- template struct S { }; int x; S<&x == &x> s; // error: template argument 1 is invalid // ^ &x == &x is a valid converted constant expression of type bool. The problem is that cp_parser_template_argument sees the initial '&' and decides that the non-type template argument must be the address-of operator applied to an id-expression; when it fails to reach the end of the template argument it aborts. This behavior is valid for <= C++03, where '&' cannot appear in a constant expression, but C++11 is more relaxed.