'Getting a compiler warning in the boost C++ libraries
I am getting this warning when I compile my Visual Studio C++ program:
Warning C26495 Variable 'boost::function_base::functor' is uninitialized. Always initialize a member variable (type.6). Project1 C:\boost\function\function_base.hpp 603
And here is the line in function_base.hpp:
public:
detail::function::vtable_base* vtable;
mutable detail::function::function_buffer functor;
Has anyone ran into this with boost and have you solved it? I tried this, but it gave errors:
mutable detail::function::function_buffer functor{};
Minimal reproducible example:
#include <boost\\algorithm\\string\\find.hpp>
int main()
{
}
This 'minimal reproducible example' gives this error: Warning C26495 Variable 'boost::function_base::functor' is uninitialized. Always initialize a member variable (type.6).
#define BOOST_VERSION 107500
#define BOOST_LIB_VERSION "1_75"
Solution 1:[1]
You probably want to disable "external warnings"
Add your Boost directory to the "External Include Directories" so that find.hpp will use the "External Includes" settings. You can then disable code analysis for this specific warning, or drop the warning level to /W3 for similar warnings.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MSalters |
