[llvm-bugs] [Bug 24904] New: clang cannot instantiate non-type template argument with static constexpr member function called via this->

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 21 12:20:14 PDT 2015


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

            Bug ID: 24904
           Summary: clang cannot instantiate non-type template argument
                    with static constexpr member function called via
                    this->
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fmatthew5876 at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

template <int A> int a() { return 1; }

class B {
  static constexpr int b() { return 2; }
  int a1() { return a<B::b()>(); }
  int a2() { return a<this->b()>(); }
};

The above compiles in gcc but clang fails with the following error:

note: candidate template ignored: invalid explicitly-specified argument for
template parameter 'A'

The problem is in B::a2(). Clang doesn't like this->b() being used for template
parameter A. clang has no problem with using B::b() as seen in B::a1().

-- 
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/20150921/d4fc9ea1/attachment.html>


More information about the llvm-bugs mailing list