This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: templated cmath function instantiation


On Mon, Jun 25, 2001 at 10:06:23PM +0200, Gabriel Dos Reis wrote:
> Phil Edwards <pedwards@disaster.jaj.com> writes:
> 
> Yes, #include <cmath> and explicitly instantiating __cmath_power for
> float, double and long double should not cause any harm.

Okay.  I was including bits/std_cmath.h (since that's all that <cmath>
includes), but I had forgotten about the other instantiations.  Thanks.


> | ... In other shadow{y,ing} schemes, the compiler will
> | complain that we are explicitly instantiating a template function that was
> | never declared and for which no primary exists.
> 
> I thought one of the agreement was that we should implement <xxx.h>
> in terms of <cxxx>.  Am I missing something?

    339% rgrep -rl cmath_power include src
    include/c_std/bits/cmath.tcc
    include/c_std/bits/std_cmath.h
    src/cmath.cc
    340%

Under 'c' or 'c_shadow', the #include <cmath> will not declare nor define
std::__cmath_power<>.  Then when building the library, the compiler will
choke on src/cmath.cc because we try to explicitly instantiate a template
which was never seen.

Of course, if anyone tries to use 'c' or 'c_shadow' right now, bigger
problems will immediately arise and prevent building long before
src/cmath.cc, so the patch is safe as it stands.


Phil

-- 
Would I had phrases that are not known, utterances that are strange, in
new language that has not been used, free from repetition, not an utterance
which has grown stale, which men of old have spoken.
                                     - anonymous Egyptian scribe, c.1700 BC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]