public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67774] New: [concepts] ICE when mismatching template arguments to concept
@ 2015-09-30  1:00 ryan.burn at gmail dot com
  2020-04-29 16:22 ` [Bug c++/67774] " ppalka at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: ryan.burn at gmail dot com @ 2015-09-30  1:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67774
           Summary: [concepts] ICE when mismatching template arguments to
                    concept
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Below code produces this ICE:

t.cpp: In function ‘int main()’:
t.cpp:21:16: error: wrong number of template arguments (1, should be 2)
   std::cout << cpt_KEvaluator<decltype(f)> << '\n';
                ^
t.cpp:16:48: note: provided for ‘template<class X, long unsigned int K>
constexpr const bool cpt_KEvaluator<X, K>’
 template <class X, std::size_t K> concept bool cpt_KEvaluator =
                                                ^
t.cpp:21:16: internal compiler error: tree check: expected tree_vec, have
error_mark in tsubst, at cp/pt.c:12570
   std::cout << cpt_KEvaluator<decltype(f)> << '\n';
                ^
0xf2508c tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9512
0x6642bc tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../gcc/gcc/tree.h:2858
0x6642bc tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:12570
0x676b70 tsubst_copy
        ../../gcc/gcc/cp/pt.c:13675
0x680c0a tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:15474
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:15044
0x66fbbc tsubst_template_arg
        ../../gcc/gcc/cp/pt.c:10260
0x67cd12 tsubst_template_args
        ../../gcc/gcc/cp/pt.c:10839
0x6621c1 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:12829
0x6623bf tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:12452
0x67cd12 tsubst_template_args
        ../../gcc/gcc/cp/pt.c:10839
0x67fafb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:15230
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:15044
0x823207 satisfy_predicate_constraint
        ../../gcc/gcc/cp/constraint.cc:1694
0x823207 satisfy_constraint_1
        ../../gcc/gcc/cp/constraint.cc:1898
0x823f76 satisfy_constraint
        ../../gcc/gcc/cp/constraint.cc:1949
0x797988 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*,
bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int)
        ../../gcc/gcc/cp/semantics.c:3585
0x702615 cp_parser_primary_expression
        ../../gcc/gcc/cp/parser.c:4817
0x70ec1b cp_parser_postfix_expression
        ../../gcc/gcc/cp/parser.c:6201
0x713679 cp_parser_unary_expression
        ../../gcc/gcc/cp/parser.c:7486
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

//////////////////////////////////////////////////////////////////
#include <type_traits>
#include <utility>
#include <iostream>

template <class X> concept bool cpt_RealScalar() {
  return std::is_floating_point<X>::value;
}

namespace detail {
template <class, class> constexpr bool k_evaluator_impl = false;

template <std::size_t... Indexes, class E>
constexpr bool k_evaluator_impl<std::index_sequence<Indexes...>, E> = true;
}

template <class X, std::size_t K> concept bool cpt_KEvaluator =
  detail::k_evaluator_impl<std::make_index_sequence<K>, X>;

int main() {
  auto f = [](int, int, int) -> double { return 3; };
  std::cout << cpt_KEvaluator<decltype(f)> << '\n';
  return 0;
}
//////////////////////////////////////////////////////////////////
>From gcc-bugs-return-498363-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Sep 30 01:11:17 2015
Return-Path: <gcc-bugs-return-498363-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 85855 invoked by alias); 30 Sep 2015 01:11:16 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 85817 invoked by uid 48); 30 Sep 2015 01:11:13 -0000
From: "ryan.burn at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/67775] New: [concepts] bug when using variadic expansions in compound requirements
Date: Wed, 30 Sep 2015 01:11:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ryan.burn at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone
Message-ID: <bug-67775-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg02341.txt.bz2
Content-length: 2269

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg775

            Bug ID: 67775
           Summary: [concepts] bug when using variadic expansions in
                    compound requirements
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code prints 0, but it should print 1.

/////////////////////////////////////////////////////////////
#include <type_traits>
#include <utility>
#include <iostream>

template <class X>
concept bool cpt_RealScalar = std::is_floating_point<X>::value;

namespace detail {
template <class, class> constexpr bool k_evaluator_impl = false;

template <std::size_t... Indexes, class E>
  requires requires(E e) {
    { e((Indexes, 0)...) } -> cpt_RealScalar;
    // requires cpt_RealScalar<decltype(e((Indexes,0)...))>; // this version
works
  }
constexpr bool k_evaluator_impl<std::index_sequence<Indexes...>, E> = true;
}

template <class X, std::size_t K> concept bool cpt_KEvaluator   detail::k_evaluator_impl<std::make_index_sequence<K>, X>;

int main() {
  auto f = [](int, int, int) -> double { return 3; };
  std::cout << cpt_KEvaluator<decltype(f), 3> << '\n';
  return 0;
}
/////////////////////////////////////////////////////////////


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

* [Bug c++/67774] [concepts] ICE when mismatching template arguments to concept
  2015-09-30  1:00 [Bug c++/67774] New: [concepts] ICE when mismatching template arguments to concept ryan.burn at gmail dot com
@ 2020-04-29 16:22 ` ppalka at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-04-29 16:22 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |10.0
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 10 then.

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

end of thread, other threads:[~2020-04-29 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-30  1:00 [Bug c++/67774] New: [concepts] ICE when mismatching template arguments to concept ryan.burn at gmail dot com
2020-04-29 16:22 ` [Bug c++/67774] " ppalka 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).