[LLVMbugs] [Bug 20451] New: Member access expression not allowed on constexpr variable template in template context

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 25 05:36:24 PDT 2014


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

            Bug ID: 20451
           Summary: Member access expression not allowed on constexpr
                    variable template in template context
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++1y
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david_work at me.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The type of a constexpr variable template-id initialized with type deduction is
not resolved, but left as auto, when resolving a member access subexpression.

All these conditions must be satisfied, but it's still a common case to
encounter. The problem does not occur with implicit accesses to operator
overload members or the like, and the type will be resolved if the variable
template is passed through an identity function.


template< typename >
struct lit {
        constexpr operator int () const { return 0; }
};

template< typename t >
constexpr auto ft() { return lit< t >(); }

template< typename t >
constexpr auto vt = ft< t >();

template constexpr lit< void > vt< void >; // Work around 19571

template< typename t >
constexpr lit< t > const & ftr() { return vt< t >; }

template< typename t >
constexpr int ftv() { return vt< t >.operator int (); } // Failure

template< typename t >
constexpr int ftic() { return vt< t >; } // No failure

static_assert ( ftr< void >().operator int () == 0, "1" ); // OK
static_assert ( ftic< void >() == 0, "2" ); // OK
static_assert ( ftv< void >() == 0, "3" );

template< typename t >
constexpr t && id( t && o ) { return static_cast< t && >( o ); }

template< typename t >
constexpr int ftvid() { return id( vt< t > ).operator int (); } // OK

static_assert ( ftvid< void >() == 0, "3a" );

-- 
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/20140725/070a4e7d/attachment.html>


More information about the llvm-bugs mailing list