From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8581 invoked by alias); 28 Mar 2015 15:49:46 -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 8519 invoked by uid 48); 28 Mar 2015 15:49:42 -0000 From: "kariya_mitsuru at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/65509] [5 Regression] [C++11] GCC rejects operator== with two distinct pointers as not constexpr Date: Sat, 28 Mar 2015 18:24: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-Version: 5.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: kariya_mitsuru at hotmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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-03/txt/msg03285.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65509 --- Comment #14 from Mitsuru Kariya --- The rev.221737 seems to be able to compile the sample code above, but cannot compile another sample code like below. ================= sample code ================= constexpr char s1[] = "s1"; constexpr char s2[] = "s2"; constexpr auto eq = (s1 + 0) == (s2 + 1); int main() {} ================= sample code ================= ================ error message ================ compare2.cpp:4:30: error: '(((const char*)(& s1)) == (((const char*)(& s2)) + 1u))' is not a constant expression constexpr auto eq = (s1 + 0) == (s2 + 1); ================ error message ================ Although the first sample causes compilation error only in 5.0.0, the second sample causes compilation error in 4.9.2 too. cf. http://melpon.org/wandbox/permlink/KhcREuNqGofbZvqw