This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/48324] New: [C++0x] constexpr evaluation should respect lifetime rules


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: unassigned@gcc.gnu.org
        ReportedBy: jason@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() { }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]