[LLVMbugs] [Bug 11100] New: conditional noexcept using constexpr template function produces an error when it should compile

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 10 02:08:53 PDT 2011


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

           Summary: conditional noexcept using constexpr template function
                    produces an error when it should compile
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: davidhunter22 at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Trunk code at revision 141529

This is sort of a follow on to http://llvm.org/bugs/show_bug.cgi?id=11084 which
related to a compiler assertion for similar code. That assertion is now fixed
however I believe the compiler is still in error ( at least according to my
newbie understanding of conditional noexcept )

Note that I am actually trying to use the GCC 4.6.0 standard C++ library on
Linux and these errors are distilled cases where the GCC compiler has no
problem with its headers while clang throws up. So it may be that clang is
right and GCC wrong.

Anyway the code in question is

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
template<typename T> struct Foo
{
    static constexpr bool foo( ) { return( true ); }
};

class Bar 
{
    void bar( ) noexcept(Foo<int>::foo());
};

int main( int, char** )
{
    Bar v;

    return( 0 );
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Which produces an error 

bug.cpp:8:26: error: argument to noexcept specifier must be a constant
expression
    void bar( ) noexcept(Foo<int>::foo());


It would seem to me that Foo<X>::foo is always a constexpr function returning a
bool for any X so you should be able to use it in a conditional noexcept
specifier.

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