<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [modules] error: constant expression not a constant expression"
   href="https://bugs.llvm.org/show_bug.cgi?id=32186">32186</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[modules] error: constant expression not a constant expression
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Modules
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>gonzalobg88@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I get the following errors with the following setup:

// t.h 
template <typename T>
struct max {
  static constexpr T val() noexcept { return T{10}; };
};

template <typename T>
static const constexpr T highest = max<T>::val();

// e.h
#pragma once
#include <t.h>

template <bool, typename A> struct if_ {};

template<typename A>
struct if_<true, A> {
  using type = A;
};

template <unsigned N>
using dep_t
= typename if_<(N < highest<char>), unsigned>::type;

template <typename T, unsigned Capacity>  
struct bar {
  using size_type = dep_t<Capacity>;
};

template<typename T,
  typename U = if_< sizeof(T) < highest<T>, T>
>
auto foo(T a) { 
  return bar<T, 100>{};
}


// main.cpp
#include <e.h>

int main() {
  auto c = foo(long{0});
  return  0;
}

// module.modulesmap
module t { header "t.h" export * }
module e { header "e.h" export * }</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>