This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/67795] Wrong code generated for conditional expression with cast


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].)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]