public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65575] New: [c++-concepts] Parse error for requires clause on functions that return a reference type
@ 2015-03-26  3:39 tom at honermann dot net
  2015-03-26 14:30 ` [Bug c++/65575] " andrew.n.sutton at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: tom at honermann dot net @ 2015-03-26  3:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65575
           Summary: [c++-concepts] Parse error for requires clause on
                    functions that return a reference type
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tom at honermann dot net

Encountered with the latest revision of the gcc c++-concepts branch (r221681). 
Parse errors are issued for function declarations that specify a requires
clause and return a reference type.  The parse error occurs whether the
function return type is specifed with a trailing return type or not.  The error
occurs for member functions as well as non-member functions.

A test case follows.  Changing the return type of f() from int& to just int
avoids the error.  Replacing the return type with a type alias for int& also
avoids the problem.

$ svn info   # From my local svn gcc repo.
Path: .
URL: svn://gcc.gnu.org/svn/gcc/branches/c++-concepts
Repository Root: svn://gcc.gnu.org/svn/gcc
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 221681
Node Kind: directory
Schedule: normal
Last Changed Author: asutton
Last Changed Rev: 221669
Last Changed Date: 2015-03-25 14:07:42 -0400 (Wed, 25 Mar 2015)

$ cat t.cpp 
template<typename T>
concept bool C = true;
auto f() -> int& requires C<int>;

$ g++ -c -std=c++1z t.cpp
t.cpp:3:16: error: requires clause after non-function declaration
 auto f() -> int& requires C<int>;
                ^


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

end of thread, other threads:[~2015-03-27 21:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26  3:39 [Bug c++/65575] New: [c++-concepts] Parse error for requires clause on functions that return a reference type tom at honermann dot net
2015-03-26 14:30 ` [Bug c++/65575] " andrew.n.sutton at gmail dot com
2015-03-27  7:11 ` tom at honermann dot net
2015-03-27 15:14 ` andrew.n.sutton at gmail dot com
2015-03-27 15:16 ` andrew.n.sutton at gmail dot com
2015-03-27 20:43 ` tom at honermann dot net
2015-03-27 21:36 ` andrew.n.sutton at gmail dot com
2015-03-28  0:45 ` tom at honermann dot net

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).