Assemble a list of the funniest actors in Hollywood and Ryan Gosling and Russell Crowe are two names that would not merit so much as an honorable mention.

These exemplars of machismo, full-scale serious-with-a-capital-s performers, have hardly a comedy between them on their accomplished oeuvres.

And yet, here they are headlining “The Nice Guys,” a ribald black comic summer action picture made by Shane Black, whose 2005 movie “Kiss Kiss Bang Bang” remains one of the shining recent examples of the form.

So what the heck is going on?

“I mean, you didn’t think that ‘Blue Valentine’ was funny?” Gosling jokingly asks, referring to the bleak 2010 relationship drama he starred in opposite Michelle Williams.

“You’re actually incorrect man,” Crowe insists, when a reporter observes that the star of “Gladiator” and “A Beautiful Mind” hasn’t spent much time on the funny stuff. “If you go back through my films, you’ll always see in the cycle, a comedy movie comes up.”

Whatever the case, the stars of “The Nice Guys,” who play a manic private eye (Gosling) and a stern enforcer from the Bronx (Crowe), tasked with finding a missing woman in seedy ’70s Los Angeles, agree that the picture offered them a rare opportunity.

“I came up in independent dramas and I loved those films, and felt lucky to have the opportunity to make them,” Gosling says. “Those were not the films I grew up on. I grew up on broad comedies. I just thought, ‘I’ll just be a fan of those.’ I didn’t know I would get a chance to make them.”

In Crowe’s case, “I have a particular type of humor. It’s not necessarily something that there are a lot of movies being made that I feel are something I can contribute [to]. Something like this, where the characters are so based in reality and truth, and the comedy comes out of the absurd situations they find themselves in, that’s something I can get into and attach myself to.”

Black, the man who brought these heavyweights together and who has been writing and directing movies in this vein for years, maintains that the unlikely casting adds an extra level of appeal for an audience.

“It was very much the intention to cast more seriously, because I didn’t picture the movie as a comedy per se,” he says. “It has to have a flare and a toughness and a style to it that doesn’t survive just casting, say, two ‘SNL’ alumni and saying, ‘Be funny.’

“The surprise of the movie I think that carries through is, if you’ve seen ‘Gladiator’ and‘Drive’ you’re not going to expect that these guys are adept at comedy. At one point, Ryan Gosling actually just does Abbott and Costello flat out. And it works because it’s him. It wouldn’t have worked if it was some comedian.”

In one of the movie’s memorable scenes, Gosling’s Holland March, sitting on a public toilet with his pants down, repeatedly kicks open a stall door in a desperate bid to keep his gun pointed at Crowe’s Jackson Healy. It’s a moment seen in the trailer and it was the first sequence Gosling shot on set.

Gosling’s story of working on it with his co-star offers an instructive glance at how these accomplished dramatic actors developed the comic chemistry that carries the movie, which hits theaters on Friday.

“I was nervous because I thought, ‘Well this may not be how Russell read the scene. This might not be how anyone did,’” Gosling says of his push to emphasize the physical comedy. “So I went to set early to practice the scene. I thought I was alone and I felt smoke, and I looked, and there was Russell, and he said, very seriously, ‘I think if you kick the door with the other foot, it might bounce back farther.’”