Skip to content

Commit 2faa028

Browse files
committed
C++ front-end: support attributes with tag-less structs
Seen in GCC's STL.
1 parent d6a23f0 commit 2faa028

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

regression/cpp/type_traits_essentials1/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ template<typename T> using x=V<T>;
2828

2929
#ifdef __GNUC__
3030
using type __attribute__((__nodebug__)) = int;
31+
template <std::size_t _Align = __alignof__(int)>
32+
struct __attribute__((__aligned__((_Align))))
33+
{
34+
} __align;
3135
#endif
3236

3337
struct alignas(0x1) t

src/cpp/parse.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4470,6 +4470,12 @@ bool Parser::rClassSpec(typet &spec)
44704470
std::cout << std::string(__indent, ' ') << "Parser::rClassSpec 3\n";
44714471
#endif
44724472

4473+
if(!optAlignas(spec))
4474+
return false;
4475+
4476+
if(!optAttribute(spec))
4477+
return false;
4478+
44734479
if(lex.LookAhead(0)=='{')
44744480
{
44754481
// no tag
@@ -4479,12 +4485,6 @@ bool Parser::rClassSpec(typet &spec)
44794485
}
44804486
else
44814487
{
4482-
if(!optAlignas(spec))
4483-
return false;
4484-
4485-
if(!optAttribute(spec))
4486-
return false;
4487-
44884488
irept name;
44894489

44904490
if(!rName(name))

0 commit comments

Comments
 (0)