Bug 58031 - invalid class template partial specialization accepted where argument list identical to primary template
Summary: invalid class template partial specialization accepted where argument list id...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2013-07-30 16:27 UTC by Jonathan Wakely
Modified: 2021-05-26 19:46 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.9.3, 5.3.0, 6.3.0, 7.3.0, 8.2.0, 9.0
Last reconfirmed: 2019-03-28 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Wakely 2013-07-30 16:27:19 UTC
template<template<typename...> class T>
  struct X
  { };

  template<template<typename> class T>
  struct X<T>
  { };

  template<typename T> struct Y { };

  X<Y> x;

The partial specialization is ill-formed, 14.5.5 [temp.class.spec] p8 says

  Within the argument list of a class template partial specialization,
  the following restrictions apply:
   - [...]
   - [...]
   - The argument list of the specialization shall not be identical
     to the implicit argument list of the primary template.

The implicit argument list of the primary template is T, which is identical to that of the partial specialization.

Clang and MSVC reject it.
Comment 1 Martin Sebor 2019-03-28 22:10:13 UTC
Confirmed.