Re: Comparing pointers to functions for constexpr fails with gcc not with clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Any opinion on the following matter I posted about two weeks ago?

On Thu, Jul 19, 2018 at 7:44 PM, Tadeus Prastowo
<tadeus.prastowo@xxxxxxxx> wrote:
> Hi!
>
> Using http://godbolt.org, I see that the following program compiles in
> any clang version that supports -std=c++14 switch (>= 3.5) but fails
> in any GCC version >= 5.1 while compiles in any GCC version <= 4.9.4
> that supports -std=c++14 switch (>= 4.8.5):
>
> template<typename T, T v>
> struct carrier {
>   static constexpr T value = v;
> };
>
> template<typename T>
> inline constexpr bool nontype_nontemplate_args_eq(T arg1, T arg2) {
>   return arg1 == arg2;
> }
> template<typename T1, typename T2>
> inline constexpr bool nontype_nontemplate_args_eq(T1, T2) {
>   return false;
> }
>
> int fn1() {
>   return 2;
> }
>
> int fn2() {
>   return 17;
> }
>
> int main() {
>   return carrier<bool, nontype_nontemplate_args_eq(&fn1, &fn2)>::value;
> }
>
> Is this GCC bug?
>
> Thanks.
>
> --
> Best regards,
> Tadeus



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux