This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67795] Wrong code generated for conditional expression with cast
- From: "frankhb1989 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 01 Oct 2015 13:13:33 +0000
- Subject: [Bug c++/67795] Wrong code generated for conditional expression with cast
- Auto-submitted: auto-generated
- References: <bug-67795-4 at http dot gcc dot gnu dot org/bugzilla/>
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:
>
> <<cleanup_point return <retval> = (struct string_view &) (struct string_view
> *) NON_LVALUE_EXPR <(struct string_view &) &(n != 0 ?
> std::experimental::fundamentals_v1::basic_string_view<char>::remove_prefix
> ((struct string_view *) s, n);, *s; : *s)>>>;
>
> while without it, I get:
>
> <<cleanup_point return <retval> = (struct string_view &) (n != 0 ?
> std::experimental::fundamentals_v1::basic_string_view<char>::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].)