Bug 539076 - Error when passing alias template as argument for template template parameter
Summary: Error when passing alias template as argument for template template parameter
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 9.5.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 9.6.0   Edit
Assignee: Nathan Ridge CLA Friend
QA Contact: Elena Laskavaia CLA Friend
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-14 09:34 EDT by Davin McCall CLA Friend
Modified: 2018-09-24 21:24 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Davin McCall CLA Friend 2018-09-14 09:34:06 EDT
The following (self-contained) code flags an error on the last line, but compiles with no error using GCC/Clang. I've tried to reduce this testcase as much as possible:

--- begin ---
template <class A>
struct hhh
{
    using handle_t = int;
    using handle_t_r = int &;
};

template <template <class A> class tt>
struct iii
{
    using handle_t = typename tt<int>::handle_t;
    using handle_t_r = typename tt<int>::handle_t_r;
};

template<typename, typename>
struct is_same
{
    static const bool value = false;
};

template<typename Tp>
struct is_same<Tp, Tp>
{
    static const bool value = true;
};

template<bool _Cond, typename Iftrue, typename Iffalse>
    struct conditional
    { typedef Iftrue type; };

template<typename Iftrue, typename Iffalse>
    struct conditional<false, Iftrue, Iffalse>
    { typedef Iffalse type; };

template <class A> using hhh_d = hhh<A>;

constexpr bool use_empty_node = is_same<typename iii<hhh_d>::handle_t_r,
        typename iii<hhh_d>::handle_t &>::value;

using node_type = conditional<use_empty_node, int, float>::type;
--- end ---
Comment 1 Eclipse Genie CLA Friend 2018-09-15 23:33:59 EDT
New Gerrit change created: https://git.eclipse.org/r/129479
Comment 2 Nathan Ridge CLA Friend 2018-09-15 23:34:31 EDT
Thanks for the report!
Comment 3 Davin McCall CLA Friend 2018-09-17 14:30:45 EDT
(In reply to Nathan Ridge from comment #2)
> Thanks for the report!

Thanks for the fix - that's great!
Comment 5 Nathan Ridge CLA Friend 2018-09-24 21:24:36 EDT
Fixed for 9.6.