Skip to content

C++ front-end: support attributes with tag-less structs #8289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions regression/cpp/gcc_attributes2/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#ifdef __GNUC__
typedef int my_int16_t __attribute__((__mode__(__HI__)));
static_assert(sizeof(my_int16_t) == 2, "16 bit");

template <std::size_t _Align = __alignof__(int)>
struct __attribute__((__aligned__((_Align))))
{
} __align;
#endif

int main()
Expand Down
12 changes: 6 additions & 6 deletions src/cpp/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4486,6 +4486,12 @@ bool Parser::rClassSpec(typet &spec)
std::cout << std::string(__indent, ' ') << "Parser::rClassSpec 3\n";
#endif

if(!optAlignas(spec))
return false;

if(!optAttribute(spec))
return false;

if(lex.LookAhead(0)=='{')
{
// no tag
Expand All @@ -4495,12 +4501,6 @@ bool Parser::rClassSpec(typet &spec)
}
else
{
if(!optAlignas(spec))
return false;

if(!optAttribute(spec))
return false;

irept name;

if(!rName(name))
Expand Down
Loading