[Bug c++/55664] Missing diagnostic "dependent using declaration resolved to type without 'typename'"

2021-07-16 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55664

Jonathan Wakely  changed:

   What|Removed |Added

   Last reconfirmed||2021-07-16
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #3 from Jonathan Wakely  ---
THe testcase is invalid, there are access errors. This fixes them, and
instantiates the template:

namespace std
{
  namespace thrust
  {
template < typename Derived >
  struct iterator_adaptor { typedef Derived base_type; };

template < typename Derived >
  struct pointer_base_base {
typedef thrust::iterator_adaptor < Derived > type;
  };

template < typename Derived >
  struct pointer_base : public pointer_base_base  :: type
  {
typedef typename pointer_base_base < Derived > :: type super_t;
using super_t::base_type;
  };

template < unsigned int DummyParameterToAvoidInstantiation >
  void mymalloc (thrust::pointer_base< void >) { };
  }
}

int main()
{
  std::thrust::pointer_base p;
  std::thrust::mymalloc<1>(p);
}

GCC still accepts this without an error. I'm not sure if the "down with
typename" changes in C++23 make it valid now anyway.

[Bug c++/55664] Missing diagnostic dependent using declaration resolved to type without 'typename'

2012-12-12 Thread redi at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55664



--- Comment #1 from Jonathan Wakely redi at gcc dot gnu.org 2012-12-12 
15:41:21 UTC ---

The template is never instantiated so no diagnostic is required.



Even if you instantiate it I'm not sure the code is necessarily ill-formed,

unles you use the name in a way that requires it to be known to be a type.



7.3.3p19 says:



   If a using-declaration uses the keyword typename and specifies a dependent

   name (14.6.2), the name introduced by the using-declaration is treated as

   a typedef-name (7.1.3).



But it doesn't say the keyword typename *must* be used is the using-declaration

specifies a dependent name.


[Bug c++/55664] Missing diagnostic dependent using declaration resolved to type without 'typename'

2012-12-12 Thread redi at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55664



--- Comment #2 from Jonathan Wakely redi at gcc dot gnu.org 2012-12-12 
15:49:30 UTC ---

(In reply to comment #1)

 But it doesn't say the keyword typename *must* be used is 



s/used is/used if/