Skip to content

Commit e0d56da

Browse files
committed
Support Visual Studio's forward enum declarations
1 parent 5b8897e commit e0d56da

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

regression/cpp/enum7/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
CORE
22
main.cpp
33

44
^EXIT=0$

src/cpp/cpp_typecheck_enum_type.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ Author: Daniel Kroening, [email protected]
1212
#include "cpp_typecheck.h"
1313

1414
#include <util/arith_tools.h>
15+
#include <util/c_types.h>
16+
#include <util/config.h>
1517

1618
#include <ansi-c/c_qualifiers.h>
17-
#include <util/c_types.h>
1819

1920
#include "cpp_enum_type.h"
2021

@@ -140,7 +141,9 @@ void cpp_typecheckt::typecheck_enum_type(typet &type)
140141
throw 0;
141142
}
142143
}
143-
else if(has_body)
144+
else if(
145+
has_body ||
146+
config.ansi_c.mode == configt::ansi_ct::flavourt::VISUAL_STUDIO)
144147
{
145148
std::string pretty_name=
146149
cpp_scopes.current_scope().prefix+id2string(base_name);
@@ -200,7 +203,8 @@ void cpp_typecheckt::typecheck_enum_type(typet &type)
200203
if(new_symbol->type.get_bool(ID_C_class))
201204
cpp_scopes.go_to(scope_identifier);
202205

203-
typecheck_enum_body(*new_symbol);
206+
if(has_body)
207+
typecheck_enum_body(*new_symbol);
204208
}
205209
else
206210
{

0 commit comments

Comments
 (0)