Skip to content

Commit 8ff5619

Browse files
authored
Merge pull request #8289 from tautschnig/bugfixes/c++-attributes-tag-less
C++ front-end: support attributes with tag-less structs
2 parents 9a0d532 + fc31dfc commit 8ff5619

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

regression/cpp/gcc_attributes2/main.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#ifdef __GNUC__
22
typedef int my_int16_t __attribute__((__mode__(__HI__)));
33
static_assert(sizeof(my_int16_t) == 2, "16 bit");
4+
5+
template <std::size_t _Align = __alignof__(int)>
6+
struct __attribute__((__aligned__((_Align))))
7+
{
8+
} __align;
49
#endif
510

611
int main()

src/cpp/parse.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -4526,6 +4526,12 @@ bool Parser::rClassSpec(typet &spec)
45264526
std::cout << std::string(__indent, ' ') << "Parser::rClassSpec 3\n";
45274527
#endif
45284528

4529+
if(!optAlignas(spec))
4530+
return false;
4531+
4532+
if(!optAttribute(spec))
4533+
return false;
4534+
45294535
if(lex.LookAhead(0)=='{')
45304536
{
45314537
// no tag
@@ -4535,12 +4541,6 @@ bool Parser::rClassSpec(typet &spec)
45354541
}
45364542
else
45374543
{
4538-
if(!optAlignas(spec))
4539-
return false;
4540-
4541-
if(!optAttribute(spec))
4542-
return false;
4543-
45444544
irept name;
45454545

45464546
if(!rName(name))

0 commit comments

Comments
 (0)