[cfe-dev] Guaranteed copy elision and GNU ?: operator
Ronald Wampler via cfe-dev
cfe-dev at lists.llvm.org
Wed Oct 25 17:42:18 PDT 2017
On Wed, Oct 25, 2017 at 7:35 PM, Hal Finkel <hfinkel at anl.gov> wrote:
>
> On 10/25/2017 02:54 PM, Ronald Wampler wrote:
>>
>> On Wed, Oct 25, 2017 at 2:09 PM, Hal Finkel <hfinkel at anl.gov> wrote:
>>
>> It prints 42 when compiled with c++14 and 0 with c++17 (c++1z).
>>
>> I also submitted this with a simpler case as
>> https://bugs.llvm.org/show_bug.cgi?id=35039
>
>
> To ask the obvious question, given that this is a GNU extension, has this
> been raised with the GCC developers? I imagine that we do want to match
> GCC's behavior in this regard.
>
Argh! This is embarrassing. I'm on a Mac and when I installed gcc I forgot
that `g++` is sym-linked to clang.
It appears that gcc never allowed this code to compile to begin with. See
godbolt: https://godbolt.org/g/8DdytF
So I guess clang should give an error here too.
> -Hal
>
>
>
> --
> Hal Finkel
> Lead, Compiler Technology and Programming Languages
> Leadership Computing Facility
> Argonne National Laboratory
>
More information about the cfe-dev
mailing list