Skip to content

Commit b7725b8

Browse files
author
Daniel Kroening
authored
Merge pull request diffblue#2306 from tautschnig/c++-qualifiers
Do not lose method qualifiers
2 parents 0612749 + 934c555 commit b7725b8

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

regression/cpp/Template_Specialisation2/test.desc

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

44
^EXIT=0$

src/cpp/cpp_typecheck_type.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ void cpp_typecheckt::typecheck_type(typet &type)
7878
}
7979
else if(type.id()==ID_pointer)
8080
{
81+
c_qualifierst qualifiers(type);
82+
8183
// the pointer/reference might have a qualifier,
8284
// but do subtype first
8385
typecheck_type(type.subtype());
@@ -114,6 +116,11 @@ void cpp_typecheckt::typecheck_type(typet &type)
114116
}
115117
}
116118
}
119+
120+
if(type.get_bool(ID_C_constant))
121+
qualifiers.is_constant = true;
122+
123+
qualifiers.write(type);
117124
}
118125
else if(type.id()==ID_array)
119126
{

src/cpp/parse.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -5222,7 +5222,13 @@ bool Parser::rTypeName(typet &tname)
52225222
if(!rDeclarator(declarator, kCastDeclarator, false, false))
52235223
return false;
52245224

5225-
tname.swap(declarator.type());
5225+
if(!declarator.method_qualifier().id().empty())
5226+
{
5227+
tname.swap(declarator.method_qualifier());
5228+
merge_types(declarator.type(), tname);
5229+
}
5230+
else
5231+
tname.swap(declarator.type());
52265232

52275233
// make type_name subtype of arg
52285234
make_subtype(type_name, tname);

0 commit comments

Comments
 (0)