[llvm-bugs] [Bug 32186] New: [modules] error: constant expression not a constant expression

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 8 16:06:41 PST 2017


            Bug ID: 32186
           Summary: [modules] error: constant expression not a constant
           Product: clang
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Modules
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gonzalobg88 at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

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 * }

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/20170309/0e6f0777/attachment.html>

More information about the llvm-bugs mailing list