Error: The Compiler Can Assume That The Address Of '...' Will Always Evaluate To 'true'
This page answers questions like these:
- Why am I getting “the compiler can assume that the address of '...' will always evaluate to 'true'” error?
Related Links:
error: expected primary-expression before ')' token
warning/error: inline function used but never defined
warning/error: invalid conversion from 'char**' to 'const char**'
Static Assertion / Compile-Time Assertion
error: the compiler can assume that the address of '...' will always evaluate to 'true'
- This confusing error has been seen in the following situations ...
- when passing a pointer, to a function or operator which understands bool but not the pointer type that you’re passing, for example:
myObject << &object;
- when returning the dynamic_cast of an address, from a function, when the return type is bool, for example:
return dynamic_cast<const YourClass*>(&object);
- Some solutions ...
- Try casting the address using static_cast<const void*>(&object).
- Try casting the address using reinterpret_cast<const void*>(&object).
- Try creating a variable to hold the cast value, then use that variable instead.
Related Links:
error: expected primary-expression before ')' token
warning/error: inline function used but never defined
warning/error: invalid conversion from 'char**' to 'const char**'
Static Assertion / Compile-Time Assertion
Home > C++ > Error: The Compiler Can Assume That The Address Of '...' Will Always Evaluate To 'true'
Tags: error the compiler can assume that the address of will always evaluate to 'true', the compiler can assume that the address of, will always evaluate to 'true', C++
Copyright © HelpDoco.com
code-cpp-error-the-compiler-can-assume-that-the-address.txt
C++/error-the-compiler-can-assume-that-the-address-of-will-always-evaluate-to-true.htm
1