http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48324

           Summary: [C++0x] constexpr evaluation should respect lifetime
                    rules
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ja...@gcc.gnu.org


// { dg-options -std=c++0x }

struct S {
  const int val;
  constexpr S(int i) : val(i) { }
};

constexpr const int& to_ref(int i) {
  return S(i).val;
}

constexpr int ary[to_ref(98)] = { }; // { dg-error "use of dead temporary" }

int main() { }

Reply via email to