Bug 69626 - [6 Regression] std::strtoll etc. no longer defined in c++98 mode
Summary: [6 Regression] std::strtoll etc. no longer defined in c++98 mode
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Jonathan Wakely
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-02 14:13 UTC by Jonathan Wakely
Modified: 2016-02-04 23:48 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-02-02 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Wakely 2016-02-02 14:13:06 UTC
for __cplusplus < 201103L bits/c++config.h does:

# ifndef _GLIBCXX_USE_C99_STDLIB
# define _GLIBCXX_USE_C99_STDLIB _GLIBCXX98_USE_C99_STDLIB
# endif

but acinclude.m4 never defines _GLIBCXX98_USE_C99_STDLIB so the C99 stdlib.h functions are no longer defined for C++98.

PR 69350 says we shouldn't be defining those non-C++98 functions anyway, but removing them now was not intentional (and we probably don't want to remove them for -std=gnu++98 anyway).



#include <cstdlib>

int main()
{
  &std::strtoll;
}

$ g++ -std=c++98 ll.cc
ll.cc: In function ‘int main()’:
ll.cc:5:4: error: ‘strtoll’ is not a member of ‘std’
   &std::strtoll;
    ^~~

ll.cc:5:4: note: suggested alternative:
In file included from /home/jwakely/gcc/6/include/c++/6.0.0/cstdlib:75:0,
                 from ll.cc:1:
/usr/include/stdlib.h:209:22: note:   ‘strtoll’
 extern long long int strtoll (const char *__restrict __nptr,
                      ^~~~~~~
Comment 1 Jonathan Wakely 2016-02-04 23:47:53 UTC
Author: redi
Date: Thu Feb  4 23:47:21 2016
New Revision: 233161

URL: https://gcc.gnu.org/viewcvs?rev=233161&root=gcc&view=rev
Log:
Test for C99 stdlib.h functions with -std=c++98

	PR libstdc++/69626
	* acinclude.m4 (GLIBCXX_ENABLE_C99): Check C99 stdlib.h functions
	with -std=c++98 and define _GLIBCXX98_USE_C99_STDLIB.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* testsuite/21_strings/c_strings/char/69626.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/21_strings/c_strings/char/69626.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/acinclude.m4
    trunk/libstdc++-v3/config.h.in
    trunk/libstdc++-v3/configure
Comment 2 Jonathan Wakely 2016-02-04 23:48:57 UTC
Fixed.