public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/64647] [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function
  2015-01-17 18:01 [Bug libstdc++/64647] New: [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function redi at gcc dot gnu.org
@ 2015-01-17 18:01 ` redi at gcc dot gnu.org
  2015-01-17 20:28 ` [Bug c++/64647] " ville.voutilainen at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2015-01-17 18:01 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-17
      Known to work|                            |4.9.2
     Ever confirmed|0                           |1


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

* [Bug libstdc++/64647] New: [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function
@ 2015-01-17 18:01 redi at gcc dot gnu.org
  2015-01-17 18:01 ` [Bug libstdc++/64647] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2015-01-17 18:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64647
           Summary: [5 Regression] [C++14] std::__max_element contains
                    code not allowed in constexpr function
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: ville.voutilainen at gmail dot com

#include <forward_list>
#include <algorithm>

int main()
{
  std::forward_list<int> v;
  std::max_element(v.begin(), v.end());
}

Compiling with -std=c++14 gives:

In file included from /home/jwakely/gcc/5/include/c++/5.0.0/algorithm:62:0,
                 from max.cc:2:
/home/jwakely/gcc/5/include/c++/5.0.0/bits/stl_algo.h: In instantiation of
‘constexpr _ForwardIterator std::__max_element(_ForwardIterator,
_ForwardIterator, _Compare) [with _ForwardIterator =
std::_Fwd_list_iterator<int>; _Compare = __gnu_cxx::__ops::_Iter_less_iter]’:
/home/jwakely/gcc/5/include/c++/5.0.0/bits/stl_algo.h:5514:43:   required from
‘constexpr _FIter std::max_element(_FIter, _FIter) [with _FIter =
std::_Fwd_list_iterator<int>]’
max.cc:7:38:   required from here
/home/jwakely/gcc/5/include/c++/5.0.0/bits/stl_algo.h:5489:35: error: variable
‘__result’ of non-literal type ‘std::_Fwd_list_iterator<int>’ in ‘constexpr’
function
       _ForwardIterator __result = __first;
                                   ^
In file included from /home/jwakely/gcc/5/include/c++/5.0.0/forward_list:38:0,
                 from max.cc:1:
/home/jwakely/gcc/5/include/c++/5.0.0/bits/forward_list.h:120:12: note:
‘std::_Fwd_list_iterator<int>’ is not literal because:
     struct _Fwd_list_iterator
            ^
/home/jwakely/gcc/5/include/c++/5.0.0/bits/forward_list.h:120:12: note:  
‘std::_Fwd_list_iterator<int>’ is not an aggregate, does not have a trivial
default constructor, and has no constexpr constructor that is not a copy or
move constructor
>From gcc-bugs-return-473667-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jan 17 18:09:24 2015
Return-Path: <gcc-bugs-return-473667-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10820 invoked by alias); 17 Jan 2015 18:09:24 -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 10428 invoked by uid 55); 17 Jan 2015 18:09:19 -0000
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/55932] [F03] ICE for structure constructor with scalar allocatable component
Date: Sat, 17 Jan 2015 18:09:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pault at gcc dot gnu.org
X-Bugzilla-Status: NEW
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:
Message-ID: <bug-55932-4-6GXungyf67@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-55932-4@http.gcc.gnu.org/bugzilla/>
References: <bug-55932-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-01/txt/msg01661.txt.bz2
Content-length: 1948

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

--- Comment #10 from Paul Thomas <pault at gcc dot gnu.org> ---
Author: pault
Date: Sat Jan 17 18:08:38 2015
New Revision: 219801

URL: https://gcc.gnu.org/viewcvs?rev!9801&root=gcc&view=rev
Log:
2015-01-17  Andre Vehreschild  <vehre@gmx.de>

    PR fortran/60357
    * primary.c (build_actual_constructor): Prevent warning.
    * trans-expr.c (alloc_scalar_allocatable_for_subcomponent_
    assignment): New function encapsulates treatment of allocatable
    components.
    (gfc_trans_subcomponent_assign): Needed to distinguish between
    regular assignment and initilization.
    (gfc_trans_structure_assign): Same.
    (gfc_conv_structure): Same.

    PR fortran/61275
    * gfortran.h: deferred_parameter is not needed, because
    it artificial does the trick completely.
    * primary.c (build_actual_constructor): Same.
    (gfc_convert_to_structure_constructor): Same.
    * resolve.c (resolve_fl_derived0): Same.
    * trans-expr.c (gfc_conv_component_ref): Prevent treating
    allocatable deferred length char arrays here.
    (gfc_trans_subcomponent_assign): Same as above.
    * trans-types.c (gfc_sym_type): This is done in
    gfc_get_derived_type already.

2015-01-17  Andre Vehreschild  <vehre@gmx.de>

    PR fortran/60357
    * gfortran.dg/alloc_comp_assign_13.f08: New test.

    PR fortran/61275
    * gfortran.dg/alloc_comp_assign_14.f08: New test.

    PR fortran/55932
    * gfortran.dg/alloc_comp_initializer_4.f03: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/alloc_comp_assign_13.f08
    trunk/gcc/testsuite/gfortran.dg/alloc_comp_assign_14.f08
    trunk/gcc/testsuite/gfortran.dg/alloc_comp_initializer_4.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/primary.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-types.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/64647] [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function
  2015-01-17 18:01 [Bug libstdc++/64647] New: [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function redi at gcc dot gnu.org
  2015-01-17 18:01 ` [Bug libstdc++/64647] " redi at gcc dot gnu.org
@ 2015-01-17 20:28 ` ville.voutilainen at gmail dot com
  2015-01-19 10:55 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-01-17 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at redhat dot com
          Component|libstdc++                   |c++

--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
This code

template<typename T>
constexpr T foo(T t)
{
  T tt = t;
  ++tt;
  return tt;
}

struct X
{
  X() { }
  X& operator++() { return *this; }
};

int main()
{
  X x;
  foo(x);
}

is accepted by clang but rejected by gcc. Moving to front-end.


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

* [Bug c++/64647] [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function
  2015-01-17 18:01 [Bug libstdc++/64647] New: [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function redi at gcc dot gnu.org
  2015-01-17 18:01 ` [Bug libstdc++/64647] " redi at gcc dot gnu.org
  2015-01-17 20:28 ` [Bug c++/64647] " ville.voutilainen at gmail dot com
@ 2015-01-19 10:55 ` rguenth at gcc dot gnu.org
  2015-01-21 20:16 ` jason at gcc dot gnu.org
  2015-01-21 20:28 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-19 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Target Milestone|---                         |5.0


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

* [Bug c++/64647] [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function
  2015-01-17 18:01 [Bug libstdc++/64647] New: [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-01-19 10:55 ` rguenth at gcc dot gnu.org
@ 2015-01-21 20:16 ` jason at gcc dot gnu.org
  2015-01-21 20:28 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2015-01-21 20:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed Jan 21 20:15:35 2015
New Revision: 219965

URL: https://gcc.gnu.org/viewcvs?rev=219965&root=gcc&view=rev
Log:
    PR c++/64647
    * constexpr.c (ensure_literal_type_for_constexpr_object): Don't
    give a hard error in a template instantiation.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-local3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c


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

* [Bug c++/64647] [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function
  2015-01-17 18:01 [Bug libstdc++/64647] New: [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-01-21 20:16 ` jason at gcc dot gnu.org
@ 2015-01-21 20:28 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2015-01-21 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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


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

end of thread, other threads:[~2015-01-21 20:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-17 18:01 [Bug libstdc++/64647] New: [5 Regression] [C++14] std::__max_element contains code not allowed in constexpr function redi at gcc dot gnu.org
2015-01-17 18:01 ` [Bug libstdc++/64647] " redi at gcc dot gnu.org
2015-01-17 20:28 ` [Bug c++/64647] " ville.voutilainen at gmail dot com
2015-01-19 10:55 ` rguenth at gcc dot gnu.org
2015-01-21 20:16 ` jason at gcc dot gnu.org
2015-01-21 20:28 ` 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).