2 /* { dg-options "-Wconversion -ftrack-macro-expansion=2" } */
3 /* { dg-require-effective-target int32plus } */
5 // Before the fix that came with this test, we'd output an error for
6 // the __INT_MAX__ token. That token has a BUILTINS_LOCATION
7 // location, so the location prefix in the warning message would
9 // <built-in>:0:0: warning: conversion to 'float' alters 'int' constant value
11 // Note the useless and confusing <built-in>:0:0 prefix. This is
12 // because '__INT_MAX__' being an internal macro token, it has a
13 // BUILTINS_LOCATION location.
15 // In this case, we want the error message to refer to the first
16 // location (in the macro expansion context) that is not a location
17 // for a built-in token. That location would be the one for where (in
18 // real source code) the __INT_MAX__ macro has been expanded.
20 // That would be something like:
22 // gcc/testsuite/g++.dg/warn/Wconversion-real-integer2.C:21:17: warning: conversion to 'float' alters 'int' constant value
24 // That is more useful.
26 #define INT_MAX __INT_MAX__ // { dg-warning "17: conversion from 'int' to 'float' changes value from .2147483647. to " }
32 vfloat = INT_MAX; // { dg-message "14: in expansion of macro .INT_MAX." }