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 249833 - Cannot resolve correct value in case of template parameter packs
Summary: Cannot resolve correct value in case of template parameter packs
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.0.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: petrk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-15 14:41 UTC by petrk
Modified: 2015-07-15 01:21 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 petrk 2015-01-15 14:41:23 UTC
struct True {
    constexpr static bool value = true;
};
struct False {
    constexpr static bool value = false;
};

template <bool val, typename T1, typename T2> 
struct If {
    typedef T2 type;
};

template <typename T1, typename T2> 
struct If<true, T1, T2> {
    typedef T1 type;
};

template <typename...Elems>
struct And {};

template <typename Element>
struct And<Element> : If<Element::value, True, False>::type {};

template <typename Element, typename...Elems> 
struct And<Element, Elems...> : If<Element::value, And<Elems...>, False>::type {};

template <bool val>
struct Check {
    typedef int false_type;
};

template <>
struct Check<true> {
    typedef int true_type;
};

int main() {
    And<True, True, False>::value; // value navigates to true instead of false
    return 0;
}
Comment 1 petrk 2015-03-19 09:34:20 UTC
Fixed in hg.netbeans.org/cnd-main/rev/29af16f8a953
Comment 2 Quality Engineering 2015-03-20 03:25:42 UTC
Integrated into 'main-silver', will be available in build *201503200001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/29af16f8a953
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Fixed #249833 - Cannot resolve correct value in case of template parameter packs
Comment 3 Quality Engineering 2015-07-15 01:21:10 UTC
Integrated into 'main-silver', will be available in build *201507150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/877a2485caed
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Additional fix for #249833 - Cannot resolve correct value in case of template parameter packs
-- removed duplicated calls of potentially time-consuming method