-
Notifications
You must be signed in to change notification settings - Fork 48
Closed
Description
Clang appears to be pickier than MSVC about where attribute lists are allowed to appear, leading to errors such as the following:
[...]\include\graphqlservice/GraphQLParse.h(43,21): error: 'nodiscard' attribute cannot be applied to types
GRAPHQLPEG_EXPORT [[nodiscard]] ast parseSchemaFile(
^
[...]\include/graphqlservice/GraphQLService.h(170,24): error: an attribute list cannot appear here
GRAPHQLSERVICE_EXPORT [[nodiscard]] bool await_ready() const;
^~~~~~~~~~~~~
Moving the [[nodiscard]]
before the export macro will fix both types of errors. I'm not sure who exactly is to blame for this, as __declspec
is of course a Microsoft extension and Clang tries to maintain compatibility with MSVC, but it would be nice to be able to build with both compilers.
I've written a minimal example here: https://godbolt.org/z/5WfvP4Gea
Metadata
Metadata
Assignees
Labels
No labels