Add hint to read source code for help

In trying to give error diagnostics with template definitions of invalid
types, the user encounters some pretty confusing error messages at
first. There is no way to get the compiler to give exactly the
diagnostics we want in a nice readable error message, so we are putting
some verbose instructions as comments in the code. However, a user might
not know to look at the source code since the error happens deep in an
unfamiliar (and complicated) class. Thus, add (yet another) error at the
front that gives a (hopefully) clear indication to look at the source
code for help in understanding the errors.
This commit is contained in:
Kenneth Moreland 2017-12-12 14:46:10 -07:00
parent c3889a1a67
commit fe9594c1d1
2 changed files with 17 additions and 0 deletions

@ -27,4 +27,20 @@
static_assert((condition), "Failed static assert: " #condition)
#define VTKM_STATIC_ASSERT_MSG(condition, message) static_assert((condition), message)
namespace vtkm
{
template <bool noError>
struct ReadTheSourceCodeHereForHelpOnThisError;
template <>
struct ReadTheSourceCodeHereForHelpOnThisError<true> : std::true_type
{
};
} // namespace vtkm
#define VTKM_READ_THE_SOURCE_CODE_FOR_HELP(noError) \
VTKM_STATIC_ASSERT(vtkm::ReadTheSourceCodeHereForHelpOnThisError<noError>::value)
#endif //vtk_m_StaticAssert_h

@ -125,6 +125,7 @@ struct DetermineHasCorrectParameters
// to Invoke is an ArrayHandle, you will get an error here because you cannot use an
// ArrayHandle in place of a CellSetIn argument. (You need to use a CellSet.) See a few
// lines later for some diagnostics to help you trace where the error occured.
VTKM_READ_THE_SOURCE_CODE_FOR_HELP(isCorrect);
// If you are getting the error described above, the following lines will give you some
// diagnostics (in the form of compile errors). Each one will result in a compile error