[cfe-commits] tgmath.h
Douglas Gregor
dgregor at apple.com
Wed Feb 18 09:48:38 PST 2009
On Feb 18, 2009, at 9:30 AM, Howard Hinnant wrote:
> On Feb 18, 2009, at 12:26 PM, Douglas Gregor wrote:
>
>> Committed, with a little twist:
>>
>> typedef void _Argument_type_is_not_arithmetic;
>> static _Argument_type_is_not_arithmetic __tg_promote(...) \
>> __attribute__((__unavailable__,__overloadable__));
>
> Nice. The '\' confused me at first, but seems harmless enough.
I guess we could give the attribute a named macro, e.g.,
static _Argument_type_is_not_arithmetic __tg_promote(...)
__ATTRACT_BAD_TGMATH_ARG
?
>> We're recovering badly from failures when calling __tg_promote. I'm
>> working on some parser/sema tweaks to improve the situation, and
>> will send an updated error message when it's done.
Here's what we get now when we try to take the sine of a pointer to
short:
tgmath_test.c:4:3: error: call to function '__tg_promote' that has
been intentionally made unavailable
sin(sp);
^~~~~~~
./tgmath.h:293:27: note: instantiated from:
#define sin(__x) __tg_sin(__tg_promote1((__x))(__x))
^
./tgmath.h:56:50: note: instantiated from:
#define __tg_promote1(__x) (__typeof__(__tg_promote(__x)))
^
In file included from tgmath_test.c:1:
./tgmath.h:41:41: note: unavailable function is declared here
static _Argument_type_is_not_arithmetic __tg_promote(...) \
^
2 diagnostics generated.
- Doug
More information about the cfe-commits
mailing list