[llvm-bugs] [Bug 27317] New: Incorrect instantiation on code with forward declaration of internal class template by clang 3.8

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 11 06:33:45 PDT 2016


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

            Bug ID: 27317
           Summary: Incorrect instantiation on code with forward
                    declaration of internal class template by clang 3.8
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: predelnik at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

I haven't exactly checked it with the standard but the following example
compiles with clang prior to 3.7, all gcc at least since 4.8, msvc 2015.
With clang 3.8 it fails with:

main.cpp:6:30: error: no type named 'NOT_EXISTING_CLASS_NAME' in
'some_spec<int>'
  using ttt = typename Spec::NOT_EXISTING_CLASS_NAME;
              ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

Could be fixed with removing
template <class RealType>
friend struct internal_class_template;
or moving internal_class_template definition higher.

This is minimized example from my actual code, so this friend declaration may
not look very rational.

#include <type_traits>

template <class Spec, typename = void>
struct C
{
  using ttt = typename Spec::NOT_EXISTING_CLASS_NAME;
};

template <class Spec>
struct C<Spec, typename std::enable_if<std::is_object<typename Spec::template
internal_class_template<int>>::value>::type>
{
};

template <typename FuncType>
struct some_spec
{
  template <class RealType>
  struct internal_class_template;

  struct internal_class
  {
  private:
    template <class RealType>
    friend struct internal_class_template;
  };

  template <class RealType>
  struct internal_class_template
  {
  };
};

int main ()
{
    C<some_spec<int>> xx {}; (void) (xx);
}

-- 
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/20160411/7edab4da/attachment.html>


More information about the llvm-bugs mailing list