Merge pull request #2344 from tautschnig/c++-vs-enum

Support Visual Studio's forward enum declarations
This commit is contained in:
Michael Tautschnig 2018-06-12 12:04:34 +01:00 committed by GitHub
commit f3a3e7951f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,4 @@
KNOWNBUG
CORE
main.cpp
^EXIT=0$

View File

@ -12,9 +12,10 @@ Author: Daniel Kroening, kroening@kroening.com
#include "cpp_typecheck.h"
#include <util/arith_tools.h>
#include <util/c_types.h>
#include <util/config.h>
#include <ansi-c/c_qualifiers.h>
#include <util/c_types.h>
#include "cpp_enum_type.h"
@ -140,7 +141,9 @@ void cpp_typecheckt::typecheck_enum_type(typet &type)
throw 0;
}
}
else if(has_body)
else if(
has_body ||
config.ansi_c.mode == configt::ansi_ct::flavourt::VISUAL_STUDIO)
{
std::string pretty_name=
cpp_scopes.current_scope().prefix+id2string(base_name);
@ -200,7 +203,8 @@ void cpp_typecheckt::typecheck_enum_type(typet &type)
if(new_symbol->type.get_bool(ID_C_class))
cpp_scopes.go_to(scope_identifier);
typecheck_enum_body(*new_symbol);
if(has_body)
typecheck_enum_body(*new_symbol);
}
else
{