Bug 71128 - [concepts] ICE on ill-formed explicit instantiation of a function concept
Summary: [concepts] ICE on ill-formed explicit instantiation of a function concept
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 9.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
: 71129 (view as bug list)
Depends on:
Blocks: concepts
  Show dependency treegraph
 
Reported: 2016-05-15 21:17 UTC by Tom Honermann
Modified: 2018-10-12 09:53 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-10-30 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Honermann 2016-05-15 21:17:32 UTC
The following ill-formed code triggers an ICE in gcc r236239.

$ cat t.cpp
template<typename T>
concept bool C() { return true; }
template bool C<int>(); // expected error: attempt to explicitly instantiate
                        // a function concept.

$ svn info
Path: .
Working Copy Root Path: /home/tom/src/gcc-trunk
URL: svn://gcc.gnu.org/svn/gcc/trunk
Relative URL: ^/trunk
Repository Root: svn://gcc.gnu.org/svn/gcc
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 236239
Node Kind: directory
Schedule: normal
Last Changed Author: uros
Last Changed Rev: 236238
Last Changed Date: 2016-05-14 05:07:13 -0400 (Sat, 14 May 2016)

$ g++ --version
g++ (GCC) 7.0.0 20160514 (experimental)
...

$ g++ -c -std=c++1z -fconcepts t.cpp
t.cpp:3:22: internal compiler error: in instantiate_decl, at cp/pt.c:21666
 template bool C<int>();
                      ^
0x6a8c51 instantiate_decl(tree_node*, int, bool)
        ../../gcc-trunk/gcc/cp/pt.c:21666
0x77751d cp_parser_explicit_instantiation
        ../../gcc-trunk/gcc/cp/parser.c:15648
0x788c79 cp_parser_declaration
        ../../gcc-trunk/gcc/cp/parser.c:12095
0x7874b6 cp_parser_declaration_seq_opt
        ../../gcc-trunk/gcc/cp/parser.c:12022
0x7877c4 cp_parser_translation_unit
        ../../gcc-trunk/gcc/cp/parser.c:4324
0x7877c4 c_parse_file()
        ../../gcc-trunk/gcc/cp/parser.c:37475
0x8e7e42 c_common_parse_file()
        ../../gcc-trunk/gcc/c-family/c-opts.c:1064
...
Comment 1 Paolo Carlini 2018-10-05 08:56:33 UTC
Mine.
Comment 2 paolo@gcc.gnu.org 2018-10-08 09:04:26 UTC
Author: paolo
Date: Mon Oct  8 09:02:55 2018
New Revision: 264914

URL: https://gcc.gnu.org/viewcvs?rev=264914&root=gcc&view=rev
Log:
/cp
2018-10-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71128
	* pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be
	explicitly instantiated.

/testsuite
2018-10-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71128
	* g++.dg/concepts/pr71128.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/concepts/pr71128.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Paolo Carlini 2018-10-08 09:07:15 UTC
Fixed.
Comment 4 Paolo Carlini 2018-10-12 09:53:56 UTC
*** Bug 71129 has been marked as a duplicate of this bug. ***