[LLVMbugs] [Bug 12288] New: rejects valid: Substitution failure with constexpr return as template value parameter.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 16 17:46:48 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12288

             Bug #: 12288
           Summary: rejects valid: Substitution failure with constexpr
                    return as template value parameter.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: aotium at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8224
  --> http://llvm.org/bugs/attachment.cgi?id=8224
test-source

Clang rejects the code below with a substitution failure.
The code compiles OK under GCC 4.6.1.
I believe it is valid code.

My guess is that foo<tTYPE>() isn't being resolved as a constexpr (as it should
be) when zug<tTYPE> is called, meaning it can't be used as a template-value
parameter for SBar.

The bug also occurs with other template-value types: Eg: if bool is changed to
int and true to 1.


(source also attached)
=== SOURCE ===
template <typename>
constexpr bool foo()
{ return true; }

template <bool>
struct SBar {};

template <typename tTYPE>
SBar<foo<tTYPE>()> zug(tTYPE qwy)
{ return SBar<foo<tTYPE>()>(); }

int main()
{ zug(1); }
===============
CLANG OUTPUT
===============
test/misc/clang-temp-subst-error.cpp:13:3: error: no matching function for call
to 'zug'
{ zug(1); }
  ^~~
test/misc/clang-temp-subst-error.cpp:9:20: note: candidate template ignored:
substitution failure [with tTYPE = int]
SBar<foo<tTYPE>()> zug(tTYPE qwy)
================

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list