public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61228] New: noexcept(expression) causes internal compiler error
@ 2014-05-19 11:35 igorkuo at meta dot ua
  2014-05-19 12:17 ` [Bug c++/61228] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: igorkuo at meta dot ua @ 2014-05-19 11:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61228
           Summary: noexcept(expression) causes internal compiler error
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: igorkuo at meta dot ua

The following code
# include <cctype>
# include <algorithm>

template<int (& F)(int)>
constexpr int safeCtype(unsigned char c) noexcept(noexcept(F(c)))
{ return F(c); }

int main()
{
    const char t[] = "a";
    //safeCtype<std::isspace>(*t);
    std::find_if(t, t + 1, safeCtype<std::isspace>);
}


compiled with
$ g++ noexcept_bug.cpp -std=c++11
produces output:
In file included from /usr/include/c++/4.9.0/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/4.9.0/algorithm:61,
                 from noexcept_bug.cpp:2:
/usr/include/c++/4.9.0/bits/predefined_ops.h: In instantiation of ‘bool
__gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with _Iterator
= const char*; _Predicate = int (*)(unsigned char) noexcept
(<uninstantiated>)]’:
/usr/include/c++/4.9.0/bits/stl_algo.h:120:22:   required from
‘_RandomAccessIterator std::__find_if(_RandomAccessIterator,
_RandomAccessIterator, _Predicate, std::random_access_iterator_tag) [with
_RandomAccessIterator = const char*; _Predicate =
__gnu_cxx::__ops::_Iter_pred<int (*)(unsigned char) noexcept
(<uninstantiated>)>]’
/usr/include/c++/4.9.0/bits/stl_algo.h:162:43:   required from ‘_Iterator
std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = const char*;
_Predicate = __gnu_cxx::__ops::_Iter_pred<int (*)(unsigned char) noexcept
(<uninstantiated>)>]’
/usr/include/c++/4.9.0/bits/stl_algo.h:3804:45:   required from ‘_IIter
std::find_if(_IIter, _IIter, _Predicate) [with _IIter = const char*; _Predicate
= int (*)(unsigned char) noexcept (<uninstantiated>)]’
noexcept_bug.cpp:11:51:   required from here
/usr/include/c++/4.9.0/bits/predefined_ops.h:231:30: internal compiler error:
in nothrow_spec_p, at cp/except.c:1271
  { return bool(_M_pred(*__it)); }
                              ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.


Internal compiler error is produced by g++4.7.2(Debian), g++4.8.2(Mageia),
g++4.9.0(Manjaro).
If "noexcept(noexcept(F(c)))" is replaced with "noexcept" OR
"safeCtype<std::isspace>(*t);" is uncommented, compilation succeeds.
>From gcc-bugs-return-451900-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon May 19 12:07:18 2014
Return-Path: <gcc-bugs-return-451900-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7769 invoked by alias); 19 May 2014 12:07:17 -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 7732 invoked by uid 48); 19 May 2014 12:07:12 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/47461] warn_unused_result attribute ignored for templates
Date: Mon, 19 May 2014 12:07:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi 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-47461-4-vY43bJ7yvk@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-47461-4@http.gcc.gnu.org/bugzilla/>
References: <bug-47461-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg01592.txt.bz2
Content-length: 416

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Works with 4.9.0

w.cc: In function ‘void f(C*)’:
w.cc:6:33: warning: ignoring return value of ‘bool C::f(T*) [with T = int]’,
declared with attribute warn_unused_result [-Wunused-result]
 void f(C* pc) { int i; pc->f(&i); }
                                 ^
>From gcc-bugs-return-451901-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon May 19 12:09:30 2014
Return-Path: <gcc-bugs-return-451901-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 9271 invoked by alias); 19 May 2014 12:09:29 -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 9232 invoked by uid 48); 19 May 2014 12:09:25 -0000
From: "plasmahh at gmx dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61229] New: warn_unused_result fails to work with member functions
Date: Mon, 19 May 2014 12:09: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: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: plasmahh at gmx dot net
X-Bugzilla-Status: UNCONFIRMED
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
Message-ID: <bug-61229-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: 2014-05/txt/msg01593.txt.bz2
Content-length: 653

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

            Bug ID: 61229
           Summary: warn_unused_result fails to work with member functions
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: plasmahh at gmx dot net

Since gcc 4.5 (4.4 is fine) the following code will not emit any warning:

struct A
{
        __attribute__((warn_unused_result)) int callme( ) { return 42; }
};


struct B
{
        void foo( A& a )
        {
            a.callme();
        }
};


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

* [Bug c++/61228] noexcept(expression) causes internal compiler error
  2014-05-19 11:35 [Bug c++/61228] New: noexcept(expression) causes internal compiler error igorkuo at meta dot ua
@ 2014-05-19 12:17 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2014-05-19 12:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-05-19
     Ever confirmed|0                           |1


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

end of thread, other threads:[~2014-05-19 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-19 11:35 [Bug c++/61228] New: noexcept(expression) causes internal compiler error igorkuo at meta dot ua
2014-05-19 12:17 ` [Bug c++/61228] " redi 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).