Skip to content

Commit c83acfb

Browse files
authored
Merge pull request #6868 from tautschnig/bugfixes/complex
Support _Complex in the C++ front-end
2 parents 890e039 + 12354e4 commit c83acfb

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

regression/ansi-c/gcc_attributes6/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE gcc-only
1+
CORE gcc-only test-c++-front-end
22
main.c
33

44
^EXIT=0$

src/cpp/cpp_convert_type.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,10 @@ void cpp_convert_plain_type(typet &type, message_handlert &message_handler)
330330
type.id() == ID_union || type.id() == ID_array || type.id() == ID_code ||
331331
type.id() == ID_unsignedbv || type.id() == ID_signedbv ||
332332
type.id() == ID_bool || type.id() == ID_floatbv || type.id() == ID_empty ||
333-
type.id() == ID_constructor || type.id() == ID_destructor)
333+
type.id() == ID_constructor || type.id() == ID_destructor ||
334+
type.id() == ID_c_enum)
334335
{
335336
}
336-
else if(type.id()==ID_c_enum)
337-
{
338-
// add width -- we use int, but the standard
339-
// doesn't guarantee that
340-
type.set(ID_width, config.ansi_c.int_width);
341-
}
342337
else if(type.id() == ID_c_bool)
343338
{
344339
type.set(ID_width, config.ansi_c.bool_width);

src/cpp/cpp_typecheck_type.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ Author: Daniel Kroening, kroening@cs.cmu.edu
99
/// \file
1010
/// C++ Language Type Checking
1111

12-
#include "cpp_typecheck.h"
13-
14-
#include <util/source_location.h>
15-
#include <util/simplify_expr.h>
1612
#include <util/c_types.h>
13+
#include <util/simplify_expr.h>
14+
#include <util/source_location.h>
1715

1816
#include <ansi-c/c_qualifiers.h>
17+
#include <ansi-c/merged_type.h>
1918

2019
#include "cpp_convert_type.h"
20+
#include "cpp_typecheck.h"
2121
#include "cpp_typecheck_fargs.h"
2222

2323
void cpp_typecheckt::typecheck_type(typet &type)
@@ -274,8 +274,19 @@ void cpp_typecheckt::typecheck_type(typet &type)
274274
}
275275
else if(type.id() == ID_gcc_attribute_mode)
276276
{
277+
PRECONDITION(type.has_subtype());
278+
merged_typet as_parsed;
279+
as_parsed.move_to_subtypes(type.subtype());
280+
type.get_sub().clear();
281+
as_parsed.move_to_subtypes(type);
282+
type.swap(as_parsed);
283+
277284
c_typecheck_baset::typecheck_type(type);
278285
}
286+
else if(type.id() == ID_complex)
287+
{
288+
// already done
289+
}
279290
else
280291
{
281292
error().source_location=type.source_location();

0 commit comments

Comments
 (0)