From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89385 invoked by alias); 1 Oct 2015 13:13:37 -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 89349 invoked by uid 48); 1 Oct 2015 13:13:34 -0000 From: "frankhb1989 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/67795] Wrong code generated for conditional expression with cast Date: Thu, 01 Oct 2015 13:13: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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: frankhb1989 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: 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-10/txt/msg00041.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67795 --- Comment #10 from frankhb1989 at gmail dot com --- (In reply to Marc Glisse from comment #7) > Hmm, with the static_cast, the front-end produces: > > < = (struct string_view &) (struct string_view > *) NON_LVALUE_EXPR <(struct string_view &) &(n != 0 ? > std::experimental::fundamentals_v1::basic_string_view::remove_prefix > ((struct string_view *) s, n);, *s; : *s)>>>; > > while without it, I get: > > < = (struct string_view &) (n != 0 ? > std::experimental::fundamentals_v1::basic_string_view::remove_prefix > ((struct string_view *) s, n);, (struct string_view *) s; : (struct > string_view *) s)>>; > > I also find it fishy. > > (note that you need -O2 or more for the warning) Thank you for the suggestion. I find these diagnostics exist with -O2 or -O3. Then the output is empty ... clang++ -Weverything with -O2/-O3 still behaves as I expect. (Only [-Wmissing-prototypes].)