[Bug c++/83003] Using the detection idiom and void_t causes an error

2019-08-09 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83003

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||mpolacek at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #4 from Marek Polacek  ---
This is now rejected:

$ xg++ -c 83003.C
83003.C: In substitution of ‘template using Zod_t = typename Zod::type
[with T = int]’:
83003.C:15:10:   required from here
83003.C:10:26: error: no type named ‘type’ in ‘struct Zod’
   10 | template  using Zod_t = typename Zod::type;
  |  ^

So fixed in r270433.

[Bug c++/83003] Using the detection idiom and void_t causes an error

2017-11-16 Thread ensadc at mailnesia dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83003

ensadc at mailnesia dot com changed:

   What|Removed |Added

 CC||ensadc at mailnesia dot com

--- Comment #3 from ensadc at mailnesia dot com ---
There doesn't even need to be a specialization of Zod.

template  class, class = void>
struct dtect1  { enum { value = 0 }; };

template  class TT>
struct dtect1 { enum { value = 1 }; };

template  struct Zod { };
template  using Zod_t = typename Zod::type;

static_assert(!dtect1::value, "");

Zod_t z2; // !!

[Bug c++/83003] Using the detection idiom and void_t causes an error

2017-11-15 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83003

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||accepts-invalid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-11-15
 Ever confirmed|0   |1

--- Comment #2 from Jonathan Wakely  ---
Reduced:

template  class, class, class = void>
struct dtect1 { enum { value = 0 }; };

template  class TT, class T>
struct dtect1 { enum { value = 1 }; };

template  struct Zod  { using type = double; };
template <>struct Zod {  };
template  using Zod_t = typename Zod::type;

static_assert(!dtect1::value, ""); // (1)

Zod_t z1; // a double
Zod_t   z2; // !!

[Bug c++/83003] Using the detection idiom and void_t causes an error

2017-11-15 Thread pkeir at outlook dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83003

Paul Keir  changed:

   What|Removed |Added

 CC||pkeir at outlook dot com

--- Comment #1 from Paul Keir  ---
Created attachment 42615
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42615=edit
The code described in the bug