Bug 382135 - error: 'nodiscard' attribute cannot be applied to types
Summary: error: 'nodiscard' attribute cannot be applied to types
Status: RESOLVED FIXED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: general (show other bugs)
Version: git master
Platform: Homebrew (macOS) macOS
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-08 19:23 UTC by Yurii Kolesnykov
Modified: 2017-07-09 22:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.1.2
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yurii Kolesnykov 2017-07-08 19:23:39 UTC
full log is here: https://gist.github.com/bb9529787dabefdee6f92129035d924b

/Users/yurikoles/kdesrc/extragear/kdevelop/kdevplatform/project/abstractfilemanagerplugin.cpp:81:63: error: 'nodiscard' attribute cannot be applied to types
    KIO::Job* eventuallyReadFolder( ProjectFolderItem* item ) Q_REQUIRED_RESULT;
                                                              ^
/usr/local/opt/qt/lib/QtCore.framework/Headers/qcompilerdetection.h:1177:31: note: expanded from macro 'Q_REQUIRED_RESULT'
#  define Q_REQUIRED_RESULT [[nodiscard]]
Comment 1 Kevin Funk 2017-07-08 23:01:58 UTC
Git commit 94fca963169b9d4421acb5b4ab22a043aed29fea by Kevin Funk.
Committed on 08/07/2017 at 23:00.
Pushed by kfunk into branch '5.1'.

Fix build with Qt 5.9.1 and clang

Summary:
Qt 5.9.1 expands Q_REQUIRED_RESULT to the `[[nodiscard]]` attribute
(see commit d254d8c19 in qtbase). This breaks the build with clang
compilers because `[[nodiscard]]` cannot be used at the end of a function
declaration:

```
error: 'nodiscard' attribute cannot be applied to types
```

For the record, GCC just issues a 'attribute ignored' warning when
`[[nodiscard]]` is used at the end of a declaration
FIXED-IN: 5.1.2

M  +1    -1    project/abstractfilemanagerplugin.cpp

https://commits.kde.org/kdevplatform/94fca963169b9d4421acb5b4ab22a043aed29fea
Comment 2 Yurii Kolesnykov 2017-07-09 10:49:56 UTC
Thanks!
Please merge it to master.
Comment 3 Kevin Funk 2017-07-09 22:50:47 UTC
Done, thanks for reporting!