mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
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:
parent
c3889a1a67
commit
fe9594c1d1
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user