I'm not saying its not illegal, Im saying with proper training it's not dangerous.
Until the next flight when you find out pieces of equipment that aren't designed to be upside down went upside down and no longer function as you thought they might.
You might think it's pretty dangerous then. Actually it's somewhere between mildly annoying and deadly depending on where things went awry.
Gyros not made for it or left to their own devices without being caged don't react well to going upside down. I flew a 172 after it had been upside down inadvertently the day before. Fortunately it was my regular work airplane flying traffic reports and typically the weather was decent enough to see the ground from my 1500-2000' work altitude. Today wasn't that day and I'd just started flying with the radio personality that came out of retirement to take his old job that I was doing back. Instead of doing the broadcasts I did flying and had someone to talk to for morning and afternoon rush hours and got paid the same. Fine by me. Anyway we depart at 0615 or whatever before daybreak time it was on an overcast winter morning. A few minutes into the flight we were on the north side of town when the attitude indicator threw in the towel. Now, getting vectored back to the airport to do a pretty easy partial panel approach wasn't a big deal. What made it a bigger deal was the sense of urgency and the snow bands that had come through requiring an approach down to the basement which was real enough for my roughly 800 hour self to be pleased in my training.
I wrote up the attitude indicator and it was replaced. What I didn't write down was that it was me the day before in the airplane when a buddy and I mistakenly ended up inverted only briefly. I was a freshly minted CFI and a buddy wanted some spin training so I obliged. After a demo and a couple spins in either direction it was decided that just at the brink of the stall, loading up the airplane and forcing it into a stall would be a better technique than waiting the 2 seconds it would take for the airplane to get there itself. Seemed reasonable enough to me so I said give it a go. Well when the rudder was kicked in a little too soon and the still flying wings finally gave way that airplane wound up on its back in a heartbeat. Just as things were going awry I took the airplane but it settled into a normal spin before any additional drama so I just recovered normally. My buddy looked over at me and asked if we were upside down, while white as a sheet. I looked back at him and said "Nah...just looked funny because of the entry..." as I swallowed the lump in my throat.
Back to the AI failure. I don't need to tell you that most other weekend warrior pilots might not be as proficient as you think you are today. I don't need to tell you that most other weekend warrior pilots weren't as proficient as I thought I was then. It's a matter of recency of experience and with flying being both a perishable skill as well as expensive it's easy to let that fall by the wayside. Having seen some real idiotic things conducting flight reviews and general proficiency training I wouldn't want what should be a relatively minor failure being a link in an accident chain. The first being their degraded skill level and the last being a smoking hole in the ground with an equipment failure somewhere in the middle. That wouldn't be fun to live with.