Hi all,
My question is if the following is considered a valid c++ code. Specifically the creation of static const reference using rvalue. 
 
#include <stdio.h>
#include <string>
#include <assert.h>

class Foo {
public:
  Foo() { printf("new foo %p\n", this); }
  ~Foo() { printf("del foo %p\n", this); }
  Foo dup() { printf("dup foo %p\n", this); return *this; }
};

static const Foo& tempPath(Foo().dup());

int main() {
  printf("ptr: %p\n", &tempPath);
  assert(&tempPath);
  return 0;
}