[llvm-bugs] [Bug 25693] New: Clang does not allow to use constexpr type conversion in non-type template argument

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 1 06:38:13 PST 2015


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: unassignedbugs at nondot.org
          Reporter: petr at kalinin.nnov.ru
                CC: llvm-bugs at lists.llvm.org
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151201/bbbde0ce/attachment.html>


More information about the llvm-bugs mailing list