Skip to content

_Alignas(x) does not work with custom types #472

Open
@vit9696

Description

@vit9696
typedef int test_int;

typedef struct
{
  _Alignas(int) _Atomic test_int a1;
  int a2;
} test_struct;

Adding the following sequence to c11.c causes the following error:

======================================================================
ERROR: test_c11_with_cpp (tests.test_general.TestParsing)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/user/Developer/pycparser/tests/test_general.py", line 62, in test_c11_with_cpp
    ast = parse_file(self._find_file('c11.c'), use_cpp=True,
  File "/Users/user/Developer/pycparser/pycparser/__init__.py", line 90, in parse_file
    return parser.parse(text, filename)
  File "/Users/user/Developer/pycparser/pycparser/c_parser.py", line 147, in parse
    return self.cparser.parse(
  File "/Users/user/Developer/pycparser/pycparser/ply/yacc.py", line 331, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "/Users/user/Developer/pycparser/pycparser/ply/yacc.py", line 1199, in parseopt_notrack
    tok = call_errorfunc(self.errorfunc, errtoken, self)
  File "/Users/user/Developer/pycparser/pycparser/ply/yacc.py", line 193, in call_errorfunc
    r = errorfunc(token)
  File "/Users/user/Developer/pycparser/pycparser/c_parser.py", line 1931, in p_error
    self._parse_error(
  File "/Users/user/Developer/pycparser/pycparser/plyparser.py", line 67, in _parse_error
    raise ParseError("%s: %s" % (coord, msg))
pycparser.plyparser.ParseError: /Users/user/Developer/pycparser/tests/c_files/c11.c:25:34: before: a1

----------------------------------------------------------------------
Ran 130 tests in 6.860s

FAILED (errors=1)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions