Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9053 closed Bugs (duplicate)

Infinite recursion assigning "const any" with GCC 4.8 in C++11 mode

Reported by: Di-an Jan <djan@…> Owned by: nasonov
Milestone: Boost 1.55.0 Component: any
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

Infinite recursion assigning "const any" with GCC 4.8 in C++11 mode because "boost::disable_if<boost::is_same<any&, ValueType> >" is not triggered with a "const any". This leads to infinite recursion at run time with no compiler warnings. Happens with Boost 1.54.0 and boost-trunk.

$ cat test-any.cpp
#include <iostream>
#include <boost/any.hpp>

int main() {
    const boost::any a = 1;
    boost::any x = a;
    std::cout << boost::any_cast<int>(x) << std::endl;
    return 0;
}

$ g++ -g --std=c++11 -pedantic -Wall -Wextra -I ~/boost-trunk test-any.cpp

$ gdb ./a.out
(gdb) r
Starting program: a.out

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff731f2e7 in _int_malloc () from /lib64/libc.so.6
(gdb) bt -10
#224597 0x0000000000401399 in boost::any::any<boost::any const>(boost::any const&&, boost::disable_if<boost::is_same<boost::any&, boost::any const>, void>::type*) (
    this=0x604098, value=<unknown type in a.out, CU 0x0, DIE 0x4300>) at boost-trunk/boost/any.hpp:80
#224598 0x00000000004014fa in boost::any::holder<boost::any const>::holder(boost::any const&&) (this=0x604090,
    value=<unknown type in a.out, CU 0x0, DIE 0x44e1>) at boost-trunk/boost/any.hpp:188
#224599 0x0000000000401399 in boost::any::any<boost::any const>(boost::any const&&, boost::disable_if<boost::is_same<boost::any&, boost::any const>, void>::type*) (
    this=0x604078, value=<unknown type in a.out, CU 0x0, DIE 0x4300>) at boost-trunk/boost/any.hpp:80
#224600 0x00000000004014fa in boost::any::holder<boost::any const>::holder(boost::any const&&) (this=0x604070,
    value=<unknown type in a.out, CU 0x0, DIE 0x44e1>) at boost-trunk/boost/any.hpp:188
#224601 0x0000000000401399 in boost::any::any<boost::any const>(boost::any const&&, boost::disable_if<boost::is_same<boost::any&, boost::any const>, void>::type*) (
    this=0x604058, value=<unknown type in a.out, CU 0x0, DIE 0x4300>) at boost-trunk/boost/any.hpp:80
#224602 0x00000000004014fa in boost::any::holder<boost::any const>::holder(boost::any const&&) (this=0x604050,
    value=<unknown type in a.out, CU 0x0, DIE 0x44e1>) at boost-trunk/boost/any.hpp:188
#224603 0x0000000000401399 in boost::any::any<boost::any const>(boost::any const&&, boost::disable_if<boost::is_same<boost::any&, boost::any const>, void>::type*) (
    this=0x604038, value=<unknown type in a.out, CU 0x0, DIE 0x4300>) at boost-trunk/boost/any.hpp:80
#224604 0x00000000004014fa in boost::any::holder<boost::any const>::holder(boost::any const&&) (this=0x604030,
    value=<unknown type in a.out, CU 0x0, DIE 0x44e1>) at boost-trunk/boost/any.hpp:188
#224605 0x0000000000401399 in boost::any::any<boost::any const>(boost::any const&&, boost::disable_if<boost::is_same<boost::any&, boost::any const>, void>::type*) (
    this=0x7fffffffdcb0, value=<unknown type in a.out, CU 0x0, DIE 0x4300>) at boost-trunk/boost/any.hpp:80
#224606 0x0000000000400e20 in main () at test-any.cpp:5

Change History (3)

comment:1 by Antony Polukhin, 9 years ago

Milestone: To Be DeterminedBoost 1.55.0
Resolution: duplicate
Status: newclosed

Fixed. This is a duplicate of #9053

comment:2 by Di-an Jan <djan@…>, 9 years ago

You mean this is a duplicate of #9215; otherwise we get an infinite recursion of bugs.

comment:3 by Antony Polukhin, 9 years ago

Every bug is an exact duplicate of itself. But this one is also a duplicate of #9215.

Thanks for the comment, it clarifies the situation!

Note: See TracTickets for help on using tickets.