[llvm-bugs] [Bug 45026] New: Incorrect "dependent using declaration resolved to type without 'typename'" error

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 25 23:14:54 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=45026

            Bug ID: 45026
           Summary: Incorrect "dependent using declaration resolved to
                    type without 'typename'" error
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: predelnik at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The test case is a bit convoluted, I reduced it with help of creduce and some
manual work. The following program:

template <typename T, typename = decltype(T().get_traits().f())>
int sfinaed_func(T);

template <typename T> struct Traits {
  typename T::NestedClass v;
  void f();
};
template <typename> struct Container;
struct TraitsClass {
  Traits<Container<int>> get_traits();
};
template <typename> struct ParentContainer {
  struct NestedClass {};
};
template <typename cl> struct Container {
  struct NestedClass : ParentContainer<cl>::NestedClass {
    using parent_t = typename ParentContainer<cl>::NestedClass;
    // using of parent constructor:
    using parent_t::NestedClass;
    // Removing parent_t alias fixes build
  };
};
auto f () {
  TraitsClass k;
  return sfinaed_func(k);
}

Fails to compile with an error:
> <source>:19:21: error: dependent using declaration resolved to type without 'typename'

on the line
`using parent_t::NestedClass;`
which is not a type but inheriting constructor syntax.
There seems to be a lot of stuff required for this behavior but particularly
type alias `parent_t` usage instead of directly mentioning the type.
Also it seems to compile fine with latest msvc and gcc:
https://gcc.godbolt.org/z/3zrKMc

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200226/4fef678a/attachment.html>


More information about the llvm-bugs mailing list