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

            Bug ID: 25693
           Summary: Clang does not allow to use constexpr type conversion
                    in non-type template argument
           Product: new-bugs
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Consider the following code:

struct A {
    constexpr operator int() const { return 42; }
};

template <int>
void foo() {}

void test(const A& value) {
    foo<value>();
}

int main() {
    A a{};
    test(a);
}

Coliru's Clang 3.7.0 with -std=c++14 rejects it
(http://coliru.stacked-crooked.com/a/c73bdb68b7e33c38) with the following
error:

main.cpp:9:5: error: no matching function for call to 'foo'
    foo<value>();
    ^~~~~~~~~~
main.cpp:6:6: note: candidate template ignored: invalid explicitly-specified
argument for 1st template parameter
void foo() {}

While Coliru's GCC 5.2.0 compiles it fine.

-----

This is based on this question:
http://stackoverflow.com/questions/33872039/invalid-explicitly-specified-argument-in-clang-but-successful-compilation-in-gcc

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to