Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Bug Compiler - Intel C++ 14.0 - Preprocessor Function & Template members

$
0
0

Hello,

I think I found a bug on Intel C++ 14 Compiler.

To hide complexity and reduce code quantity I hide my type trait behind a Preprocessor Function like this:

template < DistributionType eDistribution, typename Type, typename ParamType = Core::VoidType > struct DistributionTrait { typedef std::false_type DistributionType; };

With Preprocessor Function:

#define CreateDistribution( E, D, T, PT ) template <> \ struct DistributionTrait< E, T, PT > \ { \ typedef D DistributionType; \ }

I use it like that:

CreateDistribution( DistributionType::Uniform, std::uniform_int_distribution< u8 >,    u8, Core::VoidType ); CreateDistribution( DistributionType::Uniform, std::uniform_int_distribution< u16 >,  u16, Core::VoidType ); CreateDistribution( DistributionType::Uniform, std::uniform_int_distribution< u32 >,  u32, Core::VoidType ); CreateDistribution( DistributionType::Uniform, std::uniform_int_distribution< u64 >,  u64, Core::VoidType ); CreateDistribution( DistributionType::Uniform, std::uniform_int_distribution< s8 >,    s8, Core::VoidType ); CreateDistribution( DistributionType::Uniform, std::uniform_int_distribution< s16 >,  s16, Core::VoidType ); CreateDistribution( DistributionType::Uniform, std::uniform_int_distribution< s32 >,  s32, Core::VoidType ); CreateDistribution( DistributionType::Uniform, std::uniform_int_distribution< s64 >,  s64, Core::VoidType ); CreateDistribution( DistributionType::Uniform, std::uniform_real_distribution< f32 >, f32, Core::VoidType ); CreateDistribution( DistributionType::Uniform, std::uniform_real_distribution< f64 >, f64, Core::VoidType );

But when have more parameters when the bug occur:

CreateDistribution( DistributionType::Poisson, std::poisson_distribution< u8, f32 >,   u8, f32 );

I have an error:
2>..\Math/Random/DistributionTrait.h(49): error : expected an identifier
2>            CreateDistribution( DistributionType::Poisson, std::poisson_distribution< u8, f32 >,   u8, f32 );
2>            ^

I think in this case the compiler do not parse correctly the "Preprocessor Function", I think that is done with a sString.Split( ',' ).

Because when I use only the first parameter:

CreateDistribution( DistributionType::Poisson, std::poisson_distribution< u8 >,   u8, f32 );

Or If I hide the type behind a typedef:

typedef std::poisson_distribution< u8 > PoissonU8F32; CreateDistribution( DistributionType::Poisson, PoissonU8F32,   u8, f32 );

That work correctly.

I have a workaround, so is not a blocking issue, but this post is just a "bug-report".

Regards


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>