Skip to content

Commit 693292f

Browse files
authored
Merge pull request #8290 from tautschnig/bugfixes/c++-decl-code
C++ front-end: not all declarators are code-typed
2 parents d5c8a3c + 16b9b90 commit 693292f

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

regression/cbmc-cpp/Templates31/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$

regression/cpp/Templates3/main.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
template <class _Tp, _Tp __v>
2+
struct integral_constant
3+
{
4+
static const _Tp value = __v;
5+
};
6+
7+
template <class _Tp, _Tp __v>
8+
const _Tp integral_constant<_Tp, __v>::value;
9+
10+
typedef integral_constant<bool, true> true_type;
11+
12+
int main(int argc, char *argv[])
13+
{
14+
}

regression/cpp/Templates3/test.desc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.cpp
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$

src/cpp/cpp_declarator_converter.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ symbolt &cpp_declarator_convertert::convert(
163163

164164
// If it is a constructor, we take care of the
165165
// object initialization
166-
if(to_code_type(final_type).return_type().id() == ID_constructor)
166+
if(
167+
final_type.id() == ID_code &&
168+
to_code_type(final_type).return_type().id() == ID_constructor)
167169
{
168170
const cpp_namet &name=declarator.name();
169171

0 commit comments

Comments
 (0)