LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 35073 - Unexpected -Wunused-value with -std=c++17
Summary: Unexpected -Wunused-value with -std=c++17
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: trunk
Hardware: PC Linux
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-25 07:52 PDT by Stephan Bergmann
Modified: 2017-10-25 07:52 PDT (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Bergmann 2017-10-25 07:52:35 PDT
At least with recent Clang trunk towards 6.0:

> $ cat test.cc
> struct B {};
> struct Ref { Ref(B *); };
> struct D: B { operator Ref() { return this; } };
> void f() { Ref(*new D); }
>
> $ clang++ -std=c++14 -fsyntax-only test.cc
>
> $ clang++ -std=c++17 -fsyntax-only test.cc
> test.cc:4:12: warning: expression result unused [-Wunused-value]
> void f() { Ref(*new D); }
>            ^   ~~~~~~
> 1 warning generated.