Opened 9 years ago

Closed 8 years ago

#9544 closed Bugs (worksforme)

gcc 4.9.0 -std=c++1y breakage

Reported by: Peter A. Bigot <pab@…> Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

The program below fails to compile with development gcc in C++1y mode; it works in C++11 mode. I don't know whether this is a fault in gcc or in boost, but thought an early warning was worth providing. This is with the current super-project master branch; I believe it also fails on develop.

llc[900]$ cat /tmp/bre.cc 
#include <boost/regex.hpp>

const boost::regex e("AB");

llc[901]$ g++ --version
g++ (GCC) 4.9.0 20140104 (experimental)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

llc[902]$ g++ -std=c++11 -I/opt/boost -c /tmp/bre.cc 
llc[903]$ g++ -std=c++1y -I/opt/boost -c /tmp/bre.cc 
In file included from /opt/boost/boost/regex/v4/regex.hpp:70:0,
                 from /opt/boost/boost/regex.hpp:31,
                 from /tmp/bre.cc:1:
/opt/boost/boost/regex/v4/basic_regex_creator.hpp: In member function ‘boost::re_detail::re_literal* boost::re_detail::basic_regex_creator<charT, traits>::append_literal(charT)’:
/opt/boost/boost/regex/v4/basic_regex_creator.hpp:347:24: error: lvalue required as increment operand
       ++(result->length);
                        ^
In file included from /opt/boost/boost/regex/v4/regex.hpp:73:0,
                 from /opt/boost/boost/regex.hpp:31,
                 from /tmp/bre.cc:1:
/opt/boost/boost/regex/v4/basic_regex_parser.hpp: In member function ‘bool boost::re_detail::basic_regex_parser<charT, traits>::parse_repeat(std::size_t, std::size_t)’:
/opt/boost/boost/regex/v4/basic_regex_parser.hpp:974:21: error: lvalue required as decrement operand
       --(lit->length);

Change History (5)

comment:1 by Marshall Clow, 9 years ago

Could you try this program with the gcc that you are using, please?

struct Foo { int length; };

int main () {
	Foo * p = new Foo { 0 };
	++(p->length);
	return 0;
	}

Thanks!

comment:2 by Peter A. Bigot <pab@…>, 9 years ago

No issues.

llc[1036]$ g++ --version
g++ (GCC) 4.9.0 20140104 (experimental)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

llc[1037]$ g++ -std=c++11 -c /tmp/f.cc 
llc[1038]$ g++ -std=c++1y -c /tmp/f.cc 
llc[1039]$

comment:3 by Peter A. Bigot <pab@…>, 9 years ago

See the boost-dev mailing list for information relevant to this bug.

comment:4 by Marshall Clow, 9 years ago

[ Marshall posting for Peter ]

This issue arose as of GCC SVN commit 197248 which implements N3582. It occurs because the change on line 4109 preserves parentheses at the front end (with that change reverted, gcc works correctly).

This is now PR C++/59681. The fix in GCC is not trivial, so I've just made pull #1 so the trivial fix for boost (remove the parens) can be applied.

comment:5 by John Maddock, 8 years ago

Resolution: worksforme
Status: newclosed

This all appears to be working correctly in master and develop with gcc-4.9.0 and -std=gnu++1y so closing down.

Note: See TracTickets for help on using tickets.