This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 138344 - IDE highlights 'typename mpl::eval_if_c' line as wrong
Summary: IDE highlights 'typename mpl::eval_if_c' line as wrong
Status: RESOLVED DUPLICATE of bug 138216
Alias: None
Product: cnd
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: issues@cnd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-26 12:05 UTC by soldatov
Modified: 2008-06-28 16:07 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description soldatov 2008-06-26 12:05:55 UTC
IDE highlights 'typename mpl::eval_if_c' line as wrong (code from
/export/new_projects/boost_1_33_1/boost/aligned_storage.hpp):

#include <cstring>

namespace detail {

    union max_align {
        int t1;
        int t2;
    };
}

namespace mpl {

    template<bool C, typename F1/*, typename F2*/>
    struct eval_if_c {
        int i;
    };

    template<typename T>
    struct identity {
        int i;
    };

}

template <
      std::size_t size_
    , std::size_t alignment_
>
struct aligned_storage_imp
{
    union data_t
    {
        char buf[10];

        typename mpl::eval_if_c<
              alignment_ == std::size_t(-1)
            , mpl::identity<detail::max_align>
//            , type_with_alignment<alignment_>
            >::type align_;
    } data_;
};

int main() {
    return 0;
}
Comment 1 Alexey Vladykin 2008-06-28 16:01:25 UTC
The cause of this issue is "template_argument" rule in our grammar. It allows only "shift_expression" as argument, not a
more general "assignment_expression". But expression "alignment_ == std::size_t(-1)" can't be matched by
"shift_expression", and the parser fails.

There is a simple workaround. If you want to pass complex expression as template argument, enclose it in parentheses.
The following declaration is accepted by our parser:

typename mpl::eval_if_c<
     (alignment_ == std::size_t(-1))
    , mpl::identity<detail::max_align>
    >::type align_;
Comment 2 Alexey Vladykin 2008-06-28 16:07:12 UTC

*** This issue has been marked as a duplicate of 138216 ***