g++ -Wconversion warnings
Created by: bradbell
Compiling a simple Sacado example using the -Wconversion flag with g++ yields many warnings.
Example 1: include/Teuchos_ScalarTraits.hpp:180:49: warning: conversion to ‘char’ from ‘int’ may alter its value [-Wconversion] static inline char random() { return std::rand(); } // RAB: This version should be used for an unsigned char, not char ~~~~~~~~~^~
Example 2: include/Teuchos_as.hpp:1318:27: warning: conversion to ‘double’ alters ‘long int’ constant value [-Wfloat-conversion] t < minVal || t > maxVal, ^
Kludge: Adding the following at the beginning of files that include triinos headers seems to work: # if COMPILER_IS_GNUCXX # pragma GCC diagnostic ignored "-Wfloat-conversion" # pragma GCC diagnostic ignored "-Wconversion" # endif