Bug 77913 - error building bits/locale_conv.h: expected primary-expression before ',' token
Summary: error building bits/locale_conv.h: expected primary-expression before ',' token
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 6.2.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-10 04:51 UTC by Matthias Klose
Modified: 2016-10-10 05:06 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2016-10-10 04:51:31 UTC
[forwarded from https://bugs.debian.org/839995]

The Debian issue has an unreduced test case, and a proposed fix.

$ g++ -c MiniDriverContainerpreprocess.cpp In file included from /usr/include/c++/6/locale:43:0,
                 from /usr/include/c++/6/iomanip:43,
                 from Log.hpp:31,
                 from MiniDriverContainer.hpp:33,
                 from MiniDriverContainer.cpp:22:
/usr/include/c++/6/bits/locale_conv.h: In member function 'std::__cxx11::wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::wide_string std::__cxx11::wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::from_bytes(const char*, const char*)':
/usr/include/c++/6/bits/locale_conv.h:250:40: error: expected primary-expression before ',' token
  if (__str_codecvt_in(__first, __last, __out, *_M_cvt, _M_state,
                                        ^
/usr/include/c++/6/bits/locale_conv.h:252:4: error: return-statement with no value, in function returning 'std::__cxx11::wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::wide_string' [-fpermissive]
    return __out;
    ^~~~~~
/usr/include/c++/6/bits/locale_conv.h: In member function 'std::__cxx11::wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::byte_string std::__cxx11::wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::to_bytes(const _Elem*, const _Elem*)':
/usr/include/c++/6/bits/locale_conv.h:286:41: error: expected primary-expression before ',' token
  if (__str_codecvt_out(__first, __last, __out, *_M_cvt, _M_state,
                                         ^
/usr/include/c++/6/bits/locale_conv.h:288:4: error: return-statement with no value, in function returning 'std::__cxx11::wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::byte_string' [-fpermissive]
    return __out;
    ^~~~~~
In file included from /usr/include/c++/6/locale:43:0,
                 from /usr/include/c++/6/iomanip:43,
                 from Log.hpp:31,
                 from MiniDriverContainer.hpp:33,
                 from MiniDriverContainer.cpp:22:
/usr/include/c++/6/bits/locale_conv.h: In member function 'typename std::wbuffer_convert<_Codecvt, _Elem, _Tr>::_Wide_streambuf::int_type std::wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(typename std::wbuffer_convert<_Codecvt, _Elem, _Tr>::_Wide_streambuf::int_type)':
/usr/include/c++/6/bits/locale_conv.h:382:29: error: expected primary-expression before ',' token
  else if (!_Tr::eq_int_type(__out, _Tr::eof()))
                             ^
Comment 1 Andrew Pinski 2016-10-10 04:57:31 UTC
Who is defining __out ?
Comment 2 Andrew Pinski 2016-10-10 05:02:40 UTC
(In reply to Andrew Pinski from comment #1)
> Who is defining __out ?

Which you can find out by -dD (or -g3).  I suspect this is not a bug in libstdc++ but the headers of the program that is being compiled.
Comment 3 Andrew Pinski 2016-10-10 05:04:49 UTC
This is a bug in libgtop11dotnet:


./cardmod.h:#define __out
./cardmod.h:#define __out_bcount_part_opt(x, y)
./cardmod.h:#define __out_bcount(x)
./cardmod.h:#define __out_opt


__ is in the implementation namespace but they are abusing it.
Comment 4 Andrew Pinski 2016-10-10 05:06:54 UTC
(In reply to Andrew Pinski from comment #3)
> This is a bug in libgtop11dotnet:
> 
> 
> ./cardmod.h:#define __out
> ./cardmod.h:#define __out_bcount_part_opt(x, y)
> ./cardmod.h:#define __out_bcount(x)
> ./cardmod.h:#define __out_opt
> 
> 
> __ is in the implementation namespace but they are abusing it.

Basically they are trying to compile the sources under both MSVC++ and GCC but default to MSVC++'s source style in a way it is undefined for other compilers.