public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103667] New: [12 Regression] Accepting invalid explicitly specialized template with incorrectly ordered template parameter lists
@ 2021-12-12  4:40 matthewjbarichello at gmail dot com
  2021-12-12  5:00 ` [Bug c++/103667] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: matthewjbarichello at gmail dot com @ 2021-12-12  4:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103667

            Bug ID: 103667
           Summary: [12 Regression] Accepting invalid explicitly
                    specialized template with incorrectly ordered template
                    parameter lists
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matthewjbarichello at gmail dot com
  Target Milestone: ---

The following invalid code compiles without an error in GCC 12:

  template<typename... Args>
  struct A {
   template<auto N>
   struct B {};
  };

  template<>
  template<typename... Args>
  struct A<Args...>::B<sizeof...(Args)> {};

In versions before 12, compilation yields the following diagnostic:

  <source>:9:22: error: template argument 'sizeof... (Args)' involves template
parameter(s)
      9 | struct A<Args...>::B<sizeof...(Args)> {};
        |                      ^~~~~~~~~~~~~~~

Adding the following code to the example causes a parser ICE:

  int main() {
   A<>::B<0> b{};
  }

ICE trace:

  <source>: In function 'int main()':
  <source>:9:20: internal compiler error: in retrieve_specialization, at
cp/pt.c:1260
      9 | struct A<Args...>::B<sizeof...(Args)> {};
        |                    ^~~~~~~~~~~~~~~~~~
  0x2100639 internal_error(char const*, ...)
          ???:0
  0x7e96eb fancy_abort(char const*, int, char const*)
          ???:0
  0xa5db37 tsubst(tree_node*, tree_node*, int, tree_node*)
          ???:0
  0xa942e9 most_specialized_partial_spec(tree_node*, int)
          ???:0
  0xaa14f4 instantiate_class_template(tree_node*)
          ???:0
  0x8bd4e7 start_decl_1(tree_node*, bool)
          ???:0
  0x8e49bf start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
          ???:0
  0xa29b8d c_parse_file()
          ???:0
  0xbb6bb2 c_common_parse_file()
          ???:0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/103667] [12 Regression] Accepting invalid explicitly specialized template with incorrectly ordered template parameter lists
  2021-12-12  4:40 [Bug c++/103667] New: [12 Regression] Accepting invalid explicitly specialized template with incorrectly ordered template parameter lists matthewjbarichello at gmail dot com
@ 2021-12-12  5:00 ` pinskia at gcc dot gnu.org
  2021-12-12  5:04 ` pinskia at gcc dot gnu.org
  2021-12-12  5:07 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-12  5:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103667

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |12.0
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-12-12

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This has nothing to do with variable template argument or auto template
arugment even:
  template<typename Args>
  struct A {
   template<int N>
   struct B {};
  };

template<>
  template<typename Args>
  struct A<Args>::B<sizeof(Args)> {};

  int main() {
   A<int>::B<sizeof(int)> b{};
  }



---- CUT ----

Confirmed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/103667] [12 Regression] Accepting invalid explicitly specialized template with incorrectly ordered template parameter lists
  2021-12-12  4:40 [Bug c++/103667] New: [12 Regression] Accepting invalid explicitly specialized template with incorrectly ordered template parameter lists matthewjbarichello at gmail dot com
  2021-12-12  5:00 ` [Bug c++/103667] " pinskia at gcc dot gnu.org
@ 2021-12-12  5:04 ` pinskia at gcc dot gnu.org
  2021-12-12  5:07 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-12  5:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103667

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the ICE is a regression from 4.8.x though rather than a recent regression.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/103667] [12 Regression] Accepting invalid explicitly specialized template with incorrectly ordered template parameter lists
  2021-12-12  4:40 [Bug c++/103667] New: [12 Regression] Accepting invalid explicitly specialized template with incorrectly ordered template parameter lists matthewjbarichello at gmail dot com
  2021-12-12  5:00 ` [Bug c++/103667] " pinskia at gcc dot gnu.org
  2021-12-12  5:04 ` pinskia at gcc dot gnu.org
@ 2021-12-12  5:07 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-12  5:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103667

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is exact same issue as PR 66564, just we happen to reject the testcase
before because of the sizeof.

*** This bug has been marked as a duplicate of bug 66564 ***

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-12  5:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-12  4:40 [Bug c++/103667] New: [12 Regression] Accepting invalid explicitly specialized template with incorrectly ordered template parameter lists matthewjbarichello at gmail dot com
2021-12-12  5:00 ` [Bug c++/103667] " pinskia at gcc dot gnu.org
2021-12-12  5:04 ` pinskia at gcc dot gnu.org
2021-12-12  5:07 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).