|
Boost : |
From: Ralf W. Grosse-Kunstleve (rwgk_at_[hidden])
Date: 2003-03-05 17:14:05
Below is a stand-alone minimal test that still produces the same error message
with MIPSpro:
% CC -LANG:std zminmin.cpp
cc-1108 CC: ERROR File = zminmin.cpp, Line = 13
The indicated expression must have pointer-to-function type.
static const unsigned long value = sizeof(bdhelper_t::check());
^
1 error detected in the compilation of "zminmin.cpp".
The same code works correctly with gcc 2.96 and an EDG245-based compiler
(Compaq cxx). However, here is an interesting observation:
% cxx -std strict_ansi zminmin.cpp
% a.out
4
No problem with "strict_ansi." But:
% cxx -std ansi -D__USE_STD_IOSTREAM zminmin.cpp
cxx: Error: zminmin.cpp, line 13: operand of sizeof may not be a function
static const unsigned long value = sizeof(bdhelper_t::check());
----------------------------------------------^
cxx: Info: 1 error detected in the compilation of "zminmin.cpp".
I am jumping to the conclusion that older EDG's don't support
sizeof(some_function()). Does that sound plausible? What could be done to make
the is_base_and_derived test work with MIPSpro?
Is the test actually used in Boost.Python? -- I noticed that MIPSpro chokes
even if is_base_and_derived_impl2 is not instantiated.
Thanks!
Ralf
#include <iostream>
template <typename B, typename D>
struct bd_helper
{
static int check();
};
template<typename B, typename D>
struct is_base_and_derived_impl2
{
typedef bd_helper<B,D> bdhelper_t;
static const unsigned long value = sizeof(bdhelper_t::check());
};
int main()
{
unsigned long n = is_base_and_derived_impl2<int, float>::value;
std::cout << n << std::endl;
}
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk