[boost] [lexical_cast][random] ADL problem with gcc c++11

17 views
Skip to first unread message

Joel de Guzman

unread,
Mar 19, 2012, 7:47:59 AM3/19/12
to bo...@lists.boost.org
Hi,

I can't get this to compile on gcc-4.6.1 with -std=c++0x flag:

#include <boost/random.hpp>

int main()
{
return 0;
}

I'm getting an error in lexical_cast:

C:\dev\boost/boost/lexical_cast.hpp:1323:120: error: there are no arguments to 'swprintf'
that depend on a template parameter, so a declaration of 'swprintf' must be available
[-fpermissive]

Obviously, I can compile with -fpermissive, but I'd like to report this anyway.

Regards,
--
Joel de Guzman
http://www.boostpro.com
http://boost-spirit.com


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Antony Polukhin

unread,
Mar 19, 2012, 1:27:01 PM3/19/12
to bo...@lists.boost.org
2012/3/19 Joel de Guzman <jo...@boost-consulting.com>:

> Hi,
>
> I can't get this to compile on gcc-4.6.1 with -std=c++0x flag:
>
>  #include <boost/random.hpp>
>
>  int main()
>  {
>    return 0;
>  }
>
> I'm getting an error in lexical_cast:

Could not reproduce it with trunk version and gcc-4.6.1-9ubuntu3.
Which version of boost are you using?

--
Best regards,
Antony Polukhin

Joel de Guzman

unread,
Mar 19, 2012, 7:00:28 PM3/19/12
to bo...@lists.boost.org
On 3/20/2012 1:27 AM, Antony Polukhin wrote:
> 2012/3/19 Joel de Guzman <jo...@boost-consulting.com>:
>> Hi,
>>
>> I can't get this to compile on gcc-4.6.1 with -std=c++0x flag:
>>
>> #include <boost/random.hpp>
>>
>> int main()
>> {
>> return 0;
>> }
>>
>> I'm getting an error in lexical_cast:
>
> Could not reproduce it with trunk version and gcc-4.6.1-9ubuntu3.
> Which version of boost are you using?

I tested both trunk and release branches + the 1.49.0 release.
All fail.

I'm on Windows using gcc-4.6.1 mingw. I typically test using
BJam. I also test using the gcc compiler directly with these
flags:

-Wall -mconsole -ftemplate-depth-512 -DNDEBUG -DNDEBUG
-O3 -finline-functions -funroll-loops -Wfatal-errors
-std=c++0x -static-libgcc -static-libstdc++

==========================================================================
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/dev/tools/mingw/bin/../libexec/gcc/mingw32/
4.6.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.6.1/configure --enable-languages=c,c++,
fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2
--enable-shared --enable-libgomp --disable-win32-registry
--enable-libstdcxx-debug --enable-version-specific-runtime-libs
--build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.6.1 (GCC)
==========================================================================

Marshall Clow

unread,
Mar 19, 2012, 7:22:09 PM3/19/12
to bo...@lists.boost.org

Very strange.
I pasted your code into a file, and tried it on my Mac.
I used trunk and release branches, gcc 4.2.1 and clang (from svn).

All succeeded.

Sample command:
$ clang++ -I /Volumes/EyeFive/Marshall/Sources/boost/release junk.cpp
$

-- Marshall

Olaf van der Spek

unread,
Mar 19, 2012, 7:28:54 PM3/19/12
to bo...@lists.boost.org
On Tue, Mar 20, 2012 at 12:22 AM, Marshall Clow <mclow...@gmail.com> wrote:
> Very strange.
> I pasted your code into a file, and tried it on my Mac.
> I used trunk and release branches, gcc 4.2.1 and clang (from svn).
>
> All succeeded.

Looks like it's a known and mingw specific issue.

https://svn.boost.org/trac/boost/ticket/6252
--
Olaf

Antony Polukhin

unread,
Mar 20, 2012, 2:04:55 PM3/20/12
to bo...@lists.boost.org
2012/3/20 Olaf van der Spek <m...@vdspek.org>:

> On Tue, Mar 20, 2012 at 12:22 AM, Marshall Clow <mclow...@gmail.com> wrote:
>> Very strange.
>> I pasted your code into a file, and tried it on my Mac.
>> I used trunk and release branches, gcc 4.2.1 and clang (from svn).
>>
>> All succeeded.
>
> Looks like it's a known and mingw specific issue.

Created ticket #6717.
I'll fix it after dealing with iterator_range<> optimizations.

--
Best regards,
Antony Polukhin

_______________________________________________

Mathias Gaunard

unread,
Mar 25, 2012, 9:25:32 AM3/25/12
to bo...@lists.boost.org
On 20/03/12 00:22, Marshall Clow wrote:

> Very strange.
> I pasted your code into a file, and tried it on my Mac.
> I used trunk and release branches, gcc 4.2.1 and clang (from svn).

The bug only appears when the compiler is very strict about name lookups
in template contexts.

GCC 4.6+ is stricter than 4.2.

This particular bug is a missing include, which may be windows-specific.

Marshall Clow

unread,
Mar 25, 2012, 11:08:28 AM3/25/12
to bo...@lists.boost.org
On Mar 25, 2012, at 6:25 AM, Mathias Gaunard wrote:

> On 20/03/12 00:22, Marshall Clow wrote:
>
>> Very strange.
>> I pasted your code into a file, and tried it on my Mac.
>> I used trunk and release branches, gcc 4.2.1 and clang (from svn).
>
> The bug only appears when the compiler is very strict about name lookups in template contexts.
>
> GCC 4.6+ is stricter than 4.2.

Yes, and clang is (usually) stricter than gcc.

> This particular bug is a missing include, which may be windows-specific.

That would explain why I didn't see it.

-- Marshall

Marshall Clow Idio Software <mailto:mclow...@gmail.com>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
-- Yu Suzuki

Reply all
Reply to author
Forward
0 new messages