Opened 15 years ago

Closed 14 years ago

#1734 closed Bugs (fixed)

BOOST_STATIC_WARNING can't be passed a dependent expression

Reported by: Dave Abrahams Owned by: Robert Ramey
Milestone: Boost 1.36.0 Component: serialization
Version: Boost 1.35.0 Severity: Problem
Keywords: Cc: Beman Dawes

Description

This breaks Boost.Serialization on conforming compilers like Intel/Linux.

#include "boost/static_warning.hpp"

template <class T>
int f()
{
    BOOST_STATIC_WARNING(T::value);
    return 0;
}       

struct A{ enum { value = true }; };

int x = f<A>(); 

The problem is that there's a missing typename in the code generated by the macro:

template <class T>
int f()
{
    struct STATIC_WARNING7 { ::boost::static_warning_impl<(bool)( T::value )> ::type* p; void f() { delete p; } };
    // ---------------------^ HERE
    return 0;
}       

I think there are tricks that can help you get around this requirement (ask Daniel Wallin what he did in the Parameter library), but in the meantime BOOST_STATIC_WARNING should at least be made into a no-op for Intel C++. That is enough to get the library working on one additional platform and might even be an acceptable change for 1.35.0

Change History (1)

comment:1 by Robert Ramey, 14 years ago

Resolution: fixed
Status: newclosed

I spend a good deal of time trying to figure out a way around this.

I couldn't find a satisactory solution so I just skipeed the checking for this compiler.

RObert Ramey

Note: See TracTickets for help on using tickets.