public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64297] New: [5 Regression] ICE: canonical types differ for identical types
@ 2014-12-13 13:51 reichelt at gcc dot gnu.org
  2014-12-13 13:53 ` [Bug c++/64297] " reichelt at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-12-13 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64297
           Summary: [5 Regression] ICE: canonical types differ for
                    identical types
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The followiong valid testcase triggers an ICE on trunk:

=================================================
#include <functional>

struct A
{
  typedef bool X;
  template<int> X foo() const;
};

std::function<bool(const A*)> b(&A::foo<0>);
=================================================

bug.cc:9:43: internal compiler error: canonical types differ for identical
types bool() const and A::X() const {aka bool() const}
 std::function<bool(const A*)> b(&A::foo<0>);
                                           ^
0x74279e comptypes(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/typeck.c:1419
0x6b4c31 resolve_address_of_overloaded_function
        ../../gcc/gcc/cp/class.c:7490
0x5fc3a6 standard_conversion
        ../../gcc/gcc/cp/call.c:1124
0x609528 implicit_conversion
        ../../gcc/gcc/cp/call.c:1785
0x60ada2 add_function_candidate
        ../../gcc/gcc/cp/call.c:2092
0x60bb88 add_template_candidate_real
        ../../gcc/gcc/cp/call.c:3090
0x60c27c add_template_candidate
        ../../gcc/gcc/cp/call.c:3132
0x60c27c add_candidates
        ../../gcc/gcc/cp/call.c:5263
0x608351 build_user_type_conversion_1
        ../../gcc/gcc/cp/call.c:3640
0x60982f implicit_conversion
        ../../gcc/gcc/cp/call.c:1844
0x6090e5 reference_binding
        ../../gcc/gcc/cp/call.c:1704
0x609544 implicit_conversion
        ../../gcc/gcc/cp/call.c:1783
0x60ada2 add_function_candidate
        ../../gcc/gcc/cp/call.c:2092
0x60c2c7 add_candidates
        ../../gcc/gcc/cp/call.c:5273
0x601d70 build_new_method_call_1
        ../../gcc/gcc/cp/call.c:8021
0x601d70 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ../../gcc/gcc/cp/call.c:8217
0x603389 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
        ../../gcc/gcc/cp/call.c:7761
0x76c059 expand_default_init
        ../../gcc/gcc/cp/init.c:1720
0x76c059 expand_aggr_init_1
        ../../gcc/gcc/cp/init.c:1821
0x76cd14 build_aggr_init(tree_node*, tree_node*, int, int)
        ../../gcc/gcc/cp/init.c:1573
Please submit a full bug report, [etc.]

The regression was introduced between 2014-10-24 and 2014-11-14.


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

* [Bug c++/64297] [5 Regression] ICE: canonical types differ for identical types
  2014-12-13 13:51 [Bug c++/64297] New: [5 Regression] ICE: canonical types differ for identical types reichelt at gcc dot gnu.org
@ 2014-12-13 13:53 ` reichelt at gcc dot gnu.org
  2014-12-15 16:00 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-12-13 13:53 UTC (permalink / raw)
  To: gcc-bugs

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

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
      Known to work|                            |4.7.0, 4.8.0, 4.9.0
   Target Milestone|---                         |5.0
      Known to fail|                            |5.0


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

* [Bug c++/64297] [5 Regression] ICE: canonical types differ for identical types
  2014-12-13 13:51 [Bug c++/64297] New: [5 Regression] ICE: canonical types differ for identical types reichelt at gcc dot gnu.org
  2014-12-13 13:53 ` [Bug c++/64297] " reichelt at gcc dot gnu.org
@ 2014-12-15 16:00 ` jakub at gcc dot gnu.org
  2014-12-15 18:06 ` glisse at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-12-15 16:00 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-15
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase for -std=c++11:

namespace std {
template <typename _Tp, _Tp> struct integral_constant {
  static constexpr _Tp value = 0;
  typedef integral_constant type;
};
typedef integral_constant<int, 0> false_type;
template <int> using __bool_constant = integral_constant<int, 0>;
template <typename...> struct __and_;
struct B;
template <typename> struct is_function;
template <typename> struct C;
template <typename _Tp, typename _Cp>
struct C<_Tp _Cp::*> : integral_constant<int, is_function<_Tp>::value> {};
template <typename _Tp> struct G : C<_Tp>::type {};
template <typename> struct is_function : false_type {};
template <typename _Res, typename... _ArgTypes>
struct is_function<_Res(_ArgTypes...) const &>;
template <typename _Tp> _Tp declval();
template <typename...> using _Require = int;
template <typename> class D;
template <typename... _Types>
struct H : integral_constant<int, sizeof...(_Types)> {};
template <typename> struct F;
template <typename... _ArgTypes> struct _Mem_fn_traits_base {
  using __result_type = int;
  using __arg_types = H<_ArgTypes...>;
};
template <typename _Res, typename _Class, typename... _ArgTypes>
struct F<_Res (_Class::*)(_ArgTypes...) const> : _Mem_fn_traits_base<
                                                     _ArgTypes...> {
  using __lvalue = integral_constant<int, 0>;
};
template <typename _MemFunPtr, int = G<_MemFunPtr>::value> class _Mem_fn_base {
  using _Traits = F<_MemFunPtr>;
  using _ArgTypes = typename _Traits::__arg_types;
  template <typename _Args>
  using _CheckArgs = __bool_constant<_Args::value >= _ArgTypes::value>;

public:
  using result_type = typename _Traits::__result_type;
  template <typename... _Args, typename = _Require<typename _Traits::__lvalue,
                                                   _CheckArgs<H<_Args...> > > >
  void operator()(...);
};
template <typename _Res, typename _Class>
struct D<_Res _Class::*> : _Mem_fn_base<_Res _Class::*> {};
template <typename _Member, typename _Class>
D<_Member _Class::*> __callable_functor(_Member _Class::*);
template <typename> class function;
template <typename, typename> using __check_func_return_type = int;
template <typename _Res, typename... _ArgTypes>
class function<_Res(_ArgTypes...)> {
  template <typename _Functor>
  using _Invoke = decltype(__callable_functor(std::declval<_Functor &>())(
      std::declval<_ArgTypes>...));
  template <typename> using _NotSelf = B;
  template <typename _Functor>
  using _Callable = __and_<_NotSelf<_Functor>,
                           __check_func_return_type<_Invoke<_Functor>, _Res> >;
  template <typename, typename> using _Requires = int;
  template <typename _Functor, typename = _Requires<_Callable<_Functor>, void>
>
  function(_Functor);
};
struct A {
  typedef bool X;
  template <int> X foo() const;
};
std::function<int()> b(&A::foo<0>);

This used to be rejected, but didn't ICE, still in r217241, and ICEs with
r217250, so almost certainly it is r217250 that changed it.


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

* [Bug c++/64297] [5 Regression] ICE: canonical types differ for identical types
  2014-12-13 13:51 [Bug c++/64297] New: [5 Regression] ICE: canonical types differ for identical types reichelt at gcc dot gnu.org
  2014-12-13 13:53 ` [Bug c++/64297] " reichelt at gcc dot gnu.org
  2014-12-15 16:00 ` jakub at gcc dot gnu.org
@ 2014-12-15 18:06 ` glisse at gcc dot gnu.org
  2014-12-15 19:33 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-12-15 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
struct A {
  typedef int X;
  template <int> X m_fn1() const;
};
template <typename> struct is_function {};
is_function<int() const &> i;
struct D {
  template <typename Y, typename = is_function<Y>> D(Y);
} b(&A::m_fn1<0>);


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

* [Bug c++/64297] [5 Regression] ICE: canonical types differ for identical types
  2014-12-13 13:51 [Bug c++/64297] New: [5 Regression] ICE: canonical types differ for identical types reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-12-15 18:06 ` glisse at gcc dot gnu.org
@ 2014-12-15 19:33 ` jason at gcc dot gnu.org
  2014-12-15 20:20 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2014-12-15 19:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org


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

* [Bug c++/64297] [5 Regression] ICE: canonical types differ for identical types
  2014-12-13 13:51 [Bug c++/64297] New: [5 Regression] ICE: canonical types differ for identical types reichelt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-12-15 20:20 ` jason at gcc dot gnu.org
@ 2014-12-15 20:20 ` jason at gcc dot gnu.org
  2015-01-07 15:19 ` jason at gcc dot gnu.org
  2015-01-13 14:49 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2014-12-15 20:20 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.


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

* [Bug c++/64297] [5 Regression] ICE: canonical types differ for identical types
  2014-12-13 13:51 [Bug c++/64297] New: [5 Regression] ICE: canonical types differ for identical types reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-12-15 19:33 ` jason at gcc dot gnu.org
@ 2014-12-15 20:20 ` jason at gcc dot gnu.org
  2014-12-15 20:20 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2014-12-15 20:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Mon Dec 15 20:19:51 2014
New Revision: 218763

URL: https://gcc.gnu.org/viewcvs?rev=218763&root=gcc&view=rev
Log:
    PR c++/64297
    * typeck.c (apply_memfn_quals): Correct wrong TYPE_CANONICAL.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c


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

* [Bug c++/64297] [5 Regression] ICE: canonical types differ for identical types
  2014-12-13 13:51 [Bug c++/64297] New: [5 Regression] ICE: canonical types differ for identical types reichelt at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-12-15 20:20 ` jason at gcc dot gnu.org
@ 2015-01-07 15:19 ` jason at gcc dot gnu.org
  2015-01-13 14:49 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2015-01-07 15:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed Jan  7 15:18:21 2015
New Revision: 219308

URL: https://gcc.gnu.org/viewcvs?rev=219308&root=gcc&view=rev
Log:
    PR c++/64297
    * typeck.c (apply_memfn_quals): Correct wrong TYPE_CANONICAL.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C
Modified:
    branches/gcc-4_9-branch/gcc/cp/ChangeLog
    branches/gcc-4_9-branch/gcc/cp/typeck.c


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

* [Bug c++/64297] [5 Regression] ICE: canonical types differ for identical types
  2014-12-13 13:51 [Bug c++/64297] New: [5 Regression] ICE: canonical types differ for identical types reichelt at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2015-01-07 15:19 ` jason at gcc dot gnu.org
@ 2015-01-13 14:49 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2015-01-13 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Jan 13 14:49:04 2015
New Revision: 219534

URL: https://gcc.gnu.org/viewcvs?rev=219534&root=gcc&view=rev
Log:
    PR c++/64297
    * typeck.c (apply_memfn_quals): Correct wrong TYPE_CANONICAL.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C
Modified:
    branches/gcc-4_8-branch/gcc/cp/ChangeLog
    branches/gcc-4_8-branch/gcc/cp/typeck.c


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

end of thread, other threads:[~2015-01-13 14:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-13 13:51 [Bug c++/64297] New: [5 Regression] ICE: canonical types differ for identical types reichelt at gcc dot gnu.org
2014-12-13 13:53 ` [Bug c++/64297] " reichelt at gcc dot gnu.org
2014-12-15 16:00 ` jakub at gcc dot gnu.org
2014-12-15 18:06 ` glisse at gcc dot gnu.org
2014-12-15 19:33 ` jason at gcc dot gnu.org
2014-12-15 20:20 ` jason at gcc dot gnu.org
2014-12-15 20:20 ` jason at gcc dot gnu.org
2015-01-07 15:19 ` jason at gcc dot gnu.org
2015-01-13 14:49 ` jason 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).