Skip to content

Commit 16b9b90

Browse files
committed
C++ front-end: not all declarators are code-typed
The example included as regression test has a bool instead.
1 parent 0889cfa commit 16b9b90

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

regression/cbmc-cpp/Templates31/test.desc

Lines changed: 1 addition & 1 deletion
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

Lines changed: 14 additions & 0 deletions
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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
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)